[eclipse-poky] [PATCH v2 2/2] org.yocto.sdk.remotetools: remove YoctoBSPWizard java classes

Chin Huat Ang chin.huat.ang at intel.com
Wed Jan 31 03:59:03 PST 2018


YoctoBSPWizard no longer works as the underlying command-line tool yocto-bsp
has been removed as of sumo, see:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=95d4f4ec1e512d612242695542f04cbd472f3463

[YOCTO #12509]

Signed-off-by: Chin Huat Ang <chin.huat.ang at intel.com>
---
 .../org/yocto/sdk/remotetools/YoctoBspElement.java |  88 ----
 .../sdk/remotetools/YoctoBspPropertyElement.java   |  65 ---
 .../org/yocto/sdk/remotetools/YoctoJSONHelper.java |  95 ----
 .../sdk/remotetools/actions/YoctoBspHandler.java   |  38 --
 .../sdk/remotetools/wizards/bsp/BSPAction.java     |  32 --
 .../remotetools/wizards/bsp/BSPProgressDialog.java |  47 --
 .../sdk/remotetools/wizards/bsp/BSPThread.java     |  92 ----
 .../wizards/bsp/ErrorCollectorThread.java          |  19 -
 .../remotetools/wizards/bsp/KernelArchGetter.java  |  23 -
 .../wizards/bsp/KernelBranchesGetter.java          |  28 --
 .../sdk/remotetools/wizards/bsp/MainPage.java      | 498 --------------------
 .../wizards/bsp/OutputCollectorThread.java         |  19 -
 .../remotetools/wizards/bsp/PropertiesPage.java    | 499 ---------------------
 .../remotetools/wizards/bsp/QemuArchGetter.java    |  27 --
 .../remotetools/wizards/bsp/YoctoBSPWizard.java    |  99 ----
 15 files changed, 1669 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java

diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java
deleted file mode 100644
index e7bf054..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools;
-
-public class YoctoBspElement {
-	private String metadataLoc;
-	private String buildLoc;
-	private String bspName;
-	private String bspOutLoc;
-	private String karch;
-	private String qarch;
-	private boolean validPropertiesFile;
-
-	public YoctoBspElement()
-	{
-		this.metadataLoc = "";
-		this.buildLoc = "";
-		this.bspName = "";
-		this.bspOutLoc = "";
-		this.karch = "";
-		this.qarch = "";
-		this.validPropertiesFile = false;
-	}
-
-	public String getMetadataLoc() {
-		return metadataLoc;
-	}
-	
-	public void setMetadataLoc(String value) {
-		metadataLoc = value;
-	}
-	
-	public String getBuildLoc() {
-		return buildLoc;
-	}
-	
-	public void setBuildLoc(String value) {
-		buildLoc = value;
-	}
-	
-	public String getBspName() {
-		return bspName;
-	}
-	
-	public void setBspName(String value) {
-		this.bspName = value;
-	}
-	
-	public String getBspOutLoc() {
-		return bspOutLoc;
-	}
-	
-	public void setBspOutLoc(String value) {
-		this.bspOutLoc = value;
-	}
-	
-	public String getKarch() {
-		return karch;
-	}
-	
-	public void setKarch(String value) {
-		this.karch = value;
-	}
-	
-	public String getQarch() {
-		return qarch;
-	}
-	
-	public void setQarch(String value) {
-		this.qarch = value;
-	}
-	
-	public boolean getValidPropertiesFile() {
-		return validPropertiesFile;
-	}
-	
-	public void setValidPropertiesFile(boolean value) {
-		this.validPropertiesFile = value;
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java
deleted file mode 100644
index e88b4bd..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools;
-
-public class YoctoBspPropertyElement implements Comparable<YoctoBspPropertyElement>{
-	private String name;
-	private String type;
-	private String value;
-	private String defaultValue;
-
-	public YoctoBspPropertyElement()
-	{
-		this.name = "";
-		this.type = "";
-		this.value = "";
-		this.defaultValue = "";
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String value) {
-		name = value;
-	}
-
-	public String getType() {
-		return type;
-	}
-
-	public void setType(String value) {
-		type = value;
-	}
-
-	public String getDefaultValue() {
-		return defaultValue;
-	}
-
-	public void setDefaultValue(String value) {
-		this.defaultValue = value;
-	}
-
-	public String getValue() {
-		return value;
-	}
-
-	public void setValue(String value) {
-		this.value = value;
-	}
-
-	@Override
-	public int compareTo(YoctoBspPropertyElement o) {
-		return type.compareTo(o.type);
-	}
-
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java
deleted file mode 100644
index 36723d9..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools;
-
-import java.io.IOException;
-import java.io.FileWriter;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.HashSet;
-import java.io.FileReader;
-
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-
-public class YoctoJSONHelper {
-	private static final String PROPERTIES_FILE = "/tmp/properties.json";
-	private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json";
-
-	private static HashSet<YoctoBspPropertyElement> properties;
-
-	public static HashSet<YoctoBspPropertyElement> getProperties() throws Exception {
-		
-		properties = new HashSet<YoctoBspPropertyElement>(); 
-		try {
-			
-			JSONObject obj = (JSONObject)JSONValue.parse(new FileReader(PROPERTIES_FILE));
-			@SuppressWarnings("unchecked")
-			Set<String> keys = obj.keySet();
-			if (!keys.isEmpty()) {
-				Iterator<String> iter = keys.iterator();
-			    while (iter.hasNext()) {
-			      String key = (String)iter.next();
-			      if (validKey(key)) {
-			    	  JSONObject value_obj = (JSONObject)obj.get(key);
-			    	  YoctoBspPropertyElement elem = new YoctoBspPropertyElement();
-			    	  elem.setName(key);
-			    	  String type = (String)value_obj.get("type");
-			    	  elem.setType(type);
-			    	  if (type.contentEquals("boolean")) {
-			    		  elem.setDefaultValue((String)value_obj.get("default"));
-			    	  }
-			    	  properties.add(elem);
-			      }
-			    }
-			}
-			
-		} catch (Exception e) {
-			throw e;
-		} 
-		return properties;
-	}
-
-	@SuppressWarnings("unchecked")
-	public static void createBspJSONFile(HashSet<YoctoBspPropertyElement> properties) {
-		try {
-			/* should be JSONObject<String, Object> obj = new JSONObject<String, Object>();
-			 * but upstream json-simple would have to change.
-			 * See http://stackoverflow.com/questions/16415436/json-and-generics-in-java-type-safety-warning
-			 */
-			JSONObject obj = new JSONObject();
-			if (!properties.isEmpty()) {
-				Iterator<YoctoBspPropertyElement> it = properties.iterator();
-				while (it.hasNext()) {
-					// Get property
-					YoctoBspPropertyElement propElem = (YoctoBspPropertyElement)it.next();
-					obj.put(propElem.getName(), propElem.getValue());
-				}
-			}
-		 
-			FileWriter file = new FileWriter(PROPERTY_VALUE_FILE);
-			file.write(obj.toJSONString());
-			file.flush();
-			file.close();
-		 
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
-	
-	private static boolean validKey(String key) {
-		if (key.contains("kernel"))
-			return false;
-		if (key.contentEquals("qemuarch"))
-			return false;
-		return true;
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java
deleted file mode 100644
index c97afb6..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools.actions;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import org.yocto.sdk.remotetools.wizards.bsp.YoctoBSPWizard;
-
-public class YoctoBspHandler extends AbstractHandler {
-
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		
-		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
-		 // Instantiates and initializes the wizard
-	    YoctoBSPWizard bspWizard = new YoctoBSPWizard();
-	    //bspWizard.init(window.getWorkbench(), (IStructuredSelection)selection);
-	    // Instantiates the wizard container with the wizard and opens it
-	    WizardDialog dialog = new WizardDialog(window.getShell(), bspWizard);
-	    //dialog.create();
-	    dialog.open();
-		//YoctoBspDialog setting=new YoctoBspDialog(window.getShell());
-		//setting.open();
-		return null;
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java
deleted file mode 100644
index 171f181..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * Stores a list of items from the output of a background thread and the error message if something went wrong
- * @author ioana.grigoropol
- *
- */
-public class BSPAction {
-	private String[] items;
-	private String message;
-
-	BSPAction(String[] items, String message){
-		this.setItems(items);
-		this.setMessage(message);
-	}
-
-	public String[] getItems() {
-		return items;
-	}
-
-	public void setItems(String[] items) {
-		this.items = items;
-	}
-
-	public String getMessage() {
-		return message;
-	}
-
-	public void setMessage(String message) {
-		this.message = message;
-	}
-}
\ No newline at end of file
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java
deleted file mode 100644
index 8d5864c..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Creates a progress monitor dialog that will run in the background a BSPThread and display a custom message
- * @author ioana.grigoropol
- *
- */
-public class BSPProgressDialog extends ProgressMonitorDialog{
-	String displayMessage;
-	BSPThread getterThread;
-	Shell shell;
-
-
-	public BSPProgressDialog(Shell parent, BSPThread getterThread, String displayMessage) {
-		super(parent);
-		this.shell = parent;
-		this.getterThread = getterThread;
-		this.displayMessage = displayMessage;
-	}
-
-	public void run(boolean showProgressDialog){
-		try {
-			if (showProgressDialog)
-				super.run(true, true, new IRunnableWithProgress(){
-					@Override
-					public void run(IProgressMonitor monitor) {
-						monitor.beginTask(displayMessage + " ...", 100);
-						getterThread.run();
-						monitor.done();
-					}
-				});
-			else
-				getterThread.run();
-		} catch (Exception e) {
-			getterThread.getBspAction().setMessage(e.getMessage());
-		}
-	}
-
-	public BSPAction getBspAction() {
-		return getterThread.getBspAction();
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java
deleted file mode 100644
index f6b19ac..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-
-/**
- * Receives a command to be run on a separate thread in the background
- * It contains an BSPAction object that will collect the output & error
- * Output lines are processed and collected into the items of BSPAction
- * @author ioana.grigoropol
- *
- */
-public abstract class BSPThread implements Runnable {
-	public static final String SUCCESS = "success";
-	public static final String ERROR = "error";
-
-	private BSPAction bspAction;
-	private String command;
-
-	/**
-	 * Receives the command to be run in the background
-	 * @param command
-	 */
-	public BSPThread(String command) {
-		this.command = command;
-		this.bspAction = new BSPAction(null, null);
-	}
-
-	@Override
-	public void run() {
-		ArrayList<String> values = new ArrayList<String>();
-
-		try {
-			ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", command});
-			// redirect error stream to collect both output & error
-			builder.redirectErrorStream(true);
-			Process process = builder.start();
-			BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
-			String line = null;
-			String errorMessage = "";
-			while ( (line = br.readLine()) != null) {
-				String[] result = processLine(line);
-				String status = result[0];
-				String value = result[1];
-				if (status.equals(ERROR) && !value.isEmpty()) {
-					errorMessage += value;
-					continue;
-				}
-				if (!value.isEmpty())
-					values.add(value);
-			}
-			int exitVal = process.waitFor();
-
-			// if the background process did not exit with 0 code, we should set the status accordingly
-			if (exitVal != 0) {
-				bspAction.setMessage(errorMessage);
-				bspAction.setItems(null);
-			}
-		} catch (Exception e) {
-			bspAction.setMessage(e.getMessage());
-			bspAction.setItems(null);
-		}
-		if (!values.isEmpty()) {
-			bspAction.setMessage(null);
-			bspAction.setItems(values.toArray(new String[values.size()]));
-		}
-	}
-
-	/**
-	 * Each command ran in the background will have a different output and a different way of processing it
-	 * @param line
-	 * @return
-	 */
-	protected abstract String[] processLine(String line);
-
-	public BSPAction getBspAction() {
-		return bspAction;
-	}
-
-	public void setBspAction(BSPAction bspAction) {
-		this.bspAction = bspAction;
-	}
-
-	public String getCommand() {
-		return command;
-	}
-
-	public void setCommand(String command) {
-		this.command = command;
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java
deleted file mode 100644
index d39ac28..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * BSPThread that ignores the output of the process and returns an error if the process exits with non zero code
- * @author ioana.grigoropol
- *
- */
-public class ErrorCollectorThread extends BSPThread{
-
-	public ErrorCollectorThread(String command) {
-		super(command);
-	}
-
-	@Override
-	protected String[] processLine(String line) {
-		return null;
-	}
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java
deleted file mode 100644
index 833057a..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * BSPThread that processes the output of "yocto-bsp list karch"
- * @author ioana.grigoropol
- *
- */
-public class KernelArchGetter extends BSPThread{
-
-	public KernelArchGetter(String command) {
-		super(command);
-	}
-
-	@Override
-	protected String[] processLine(String line) {
-		if (line.contains(":"))
-			return new String[]{SUCCESS, ""};
-		line = line.replaceAll("^\\s+", "");
-		line = line.replaceAll("\\s+$", "");
-		return new String[]{SUCCESS, line};
-	}
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java
deleted file mode 100644
index 4caea2c..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * BSPThread that processes the output lines from running command "yocto-bsp list" for the selected kernel
- * @author ioana.grigoropol
- *
- */
-public class KernelBranchesGetter extends BSPThread {
-
-	public KernelBranchesGetter(String command) {
-		super(command);
-	}
-
-	@Override
-	protected String[] processLine(String line) {
-		// [TODO : Ioana]: find a better way to identify error lines
-		if (!line.startsWith("["))
-			return new String[]{ERROR, line + "\n"};
-
-		String[] items = line.split(",");
-
-		String value = items[0];
-		value = value.replace("[\"", "");
-		value = value.replaceAll("\"$", "");
-		return new String[]{SUCCESS, value};
-	}
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java
deleted file mode 100644
index cc3630f..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java
+++ /dev/null
@@ -1,498 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.yocto.sdk.remotetools.YoctoBspElement;
-
-/**
- *
- * Setting up the parameters for creating the new Yocto BSP
- *
- * @author jzhang
- */
-public class MainPage extends WizardPage {
-	public static  final String  PAGE_NAME = "Main";
-	private static final String KARCH_CMD = "yocto-bsp list karch";
-	private static final String QARCH_CMD = "yocto-bsp list qemu property qemuarch";
-	private static final String BSP_SCRIPT = "yocto-bsp";
-	private static final String PROPERTIES_CMD_PREFIX = "yocto-bsp list ";
-	private static final String PROPERTIES_CMD_SURFIX = " properties -o ";
-	private static final String PROPERTIES_FILE = "/tmp/properties.json";
-
-	private Button btnMetadataLoc;
-	private Text textMetadataLoc;
-	private Label labelMetadata;
-
-	private Button btnBspOutputLoc;
-	private Text textBspOutputLoc;
-	private Label labelBspOutput;
-
-	private Button btnBuildLoc;
-	private Text textBuildLoc;
-	private Label labelBuildLoc;
-
-	private boolean buildDirChecked;
-	private BuildLocationListener buildLocationListener;
-
-	private Text textBspName;
-	private Label labelBspName;
-
-	private Combo comboKArch;
-	private Label labelKArch;
-
-	private Combo comboQArch;
-	private Label labelQArch;
-
-	private YoctoBspElement bspElem;
-
-	public MainPage(YoctoBspElement element) {
-		super(PAGE_NAME, "yocto-bsp Main page", null);
-
-		setMessage("Enter the required fields(with *) to create new Yocto Project BSP!");
-		this.bspElem = element;
-	}
-
-	@Override
-	public void createControl(Composite parent) {
-		setErrorMessage(null);
-		Composite composite = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout(2, false);
-		GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-		composite.setLayout(layout);
-		gd.horizontalSpan = 2;
-		composite.setLayoutData(gd);
-
-		labelMetadata = new Label(composite, SWT.NONE);
-		labelMetadata.setText("Metadata location*: ");
-		Composite textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-		textMetadataLoc = (Text)addTextControl(textContainer, "");
-		textMetadataLoc.setEnabled(true);
-		textMetadataLoc.addModifyListener(new ModifyListener() {
-			@Override
-			public void modifyText(ModifyEvent e) {
-				controlChanged(e.widget);
-			}
-		});
-		setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc));
-
-		labelBuildLoc = new Label(composite, SWT.NONE);
-		labelBuildLoc.setText("Build location: ");
-
-		textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-		textBuildLoc = (Text)addTextControl(textContainer, "");
-		buildLocationListener = new BuildLocationListener("");
-		textBuildLoc.addFocusListener(buildLocationListener);
-
-		setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc));
-
-		labelBspName = new Label(composite, SWT.NONE);
-		labelBspName.setText("BSP Name*: ");
-
-		textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-		textBspName = (Text)addTextControl(textContainer, "");
-		textBspName.addModifyListener(new ModifyListener() {
-			@Override
-			public void modifyText(ModifyEvent e) {
-				controlChanged(e.widget);
-			}
-		});
-
-		labelBspOutput = new Label(composite, SWT.NONE);
-		labelBspOutput.setText("BSP output location: ");
-
-		textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-		textBspOutputLoc = (Text)addTextControl(textContainer, "");
-		textBspOutputLoc.addModifyListener(new ModifyListener() {
-			@Override
-			public void modifyText(ModifyEvent e) {
-				controlChanged(e.widget);
-			}
-		});
-		setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc));
-
-		labelKArch = new Label(composite, SWT.NONE);
-		labelKArch.setText("Kernel Architecture*: ");
-
-		textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-		comboKArch = new Combo(textContainer, SWT.READ_ONLY);
-		comboKArch.setLayout(new GridLayout(2, false));
-		comboKArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		comboKArch.setEnabled(false);
-		comboKArch.addModifyListener(new ModifyListener() {
-			@Override
-			public void modifyText(ModifyEvent e) {
-				controlChanged(e.widget);
-			}
-		});
-
-		labelQArch = new Label(composite, SWT.NONE);
-		labelQArch.setText("Qemu Architecture(* for karch as qemu): ");
-		labelQArch.setEnabled(false);
-
-		textContainer = new Composite(composite, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-		comboQArch = new Combo(textContainer, SWT.READ_ONLY);
-		comboQArch.setLayout(new GridLayout(2, false));
-		comboQArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		comboQArch.setEnabled(false);
-		comboQArch.addModifyListener(new ModifyListener() {
-			@Override
-			public void modifyText(ModifyEvent e) {
-				controlChanged(e.widget);
-			}
-		});
-
-		setControl(composite);
-		validatePage();
-	}
-
-	private Control addTextControl(final Composite parent, String value) {
-		final Text text;
-
-		text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
-		text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-		text.setText(value);
-		text.setSize(10, 150);
-
-		return text;
-	}
-
-	private Button addFileSelectButton(final Composite parent, final Text text) {
-		Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
-		button.setText("Browse...");
-		button.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent event) {
-				String dirName = new DirectoryDialog(parent.getShell()).open();
-				if (dirName != null) {
-					text.setText(dirName);
-				}
-			}
-		});
-		return button;
-	}
-
-	private void controlChanged(Widget widget) {
-		Status status = new Status(IStatus.OK, "not_used", 0, "", null);
-		setErrorMessage(null);
-		String metadataLoc = textMetadataLoc.getText();
-
-		if (widget == textMetadataLoc) {
-			resetKarchCombo();
-			if (metadataLoc.length() == 0) {
-				status = new Status(IStatus.ERROR, "not_used", 0, "Meta data location can't be empty!", null);
-			} else {
-				File meta_data = new File(metadataLoc);
-				if (!meta_data.exists() || !meta_data.isDirectory()) {
-					status = new Status(IStatus.ERROR, "not_used", 0,
-							"Invalid meta data location: Make sure it exists and is a directory!", null);
-				} else {
-					File bspScript = new File(metadataLoc + "/scripts/" + BSP_SCRIPT);
-					if (!bspScript.exists() || !bspScript.canExecute())
-						status = new Status(IStatus.ERROR, "not_used", 0,
-								"Make sure yocto-bsp exists under \"" + metadataLoc + "/scripts\" and is executable!", null);
-					else {
-						kernelArchesHandler();
-					}
-				}
-			}
-		} else if (widget == comboKArch) {
-			String selection = comboKArch.getText();
-			if (!bspElem.getKarch().contentEquals(selection))
-				bspElem = new YoctoBspElement();
-			if (selection.matches("qemu")) {
-				labelQArch.setEnabled(true);
-				comboQArch.setEnabled(true);
-			} else {
-				labelQArch.setEnabled(false);
-				comboQArch.setEnabled(false);
-			}
-		}
-
-		String buildDir = textBuildLoc.getText();
-		String outputDir = textBspOutputLoc.getText();
-		String bspName = textBspName.getText();
-		
-		if (bspName.contains(" ")) {
-			status = new Status(IStatus.ERROR, "not_used", 0,
-					"BSP name contains space which is not allowed!", null);
-		}
-
-		if (!outputDir.isEmpty()){
-			if (outputDir.matches(buildDir)) {
-				status = new Status(IStatus.ERROR, "not_used", 0,
-						"You've set BSP output directory the same as build directory, please leave output directory empty for this scenario!", null);
-			} else {
-				File outputDirectory = new File(outputDir);
-				if (outputDirectory.exists()){
-					status = new Status(IStatus.ERROR, "not_used", 0,
-							"Your BSP output directory points to an existing directory!", null);
-				}
-			}
-		} else if (buildDir.startsWith(metadataLoc) && !bspName.isEmpty()) {
-			String bspDirStr = metadataLoc + "/meta-" + bspName;
-			File bspDir = new File(bspDirStr);
-			if (bspDir.exists()) {
-				status = new Status(IStatus.ERROR, "not_used", 0,
-						"Your BSP with name: " + bspName + " already exist under directory: " + bspDirStr + ", please change your bsp name!", null);
-			}
-		}
-
-		if (status.getSeverity() == IStatus.ERROR)
-			setErrorMessage(status.getMessage());
-
-		getWizard().getContainer().updateButtons();
-		canFlipToNextPage();
-	}
-
-	private Status checkBuildDir() {
-
-		String metadataLoc = textMetadataLoc.getText();
-		String buildLoc = textBuildLoc.getText();
-
-		if (buildLoc.isEmpty()) {
-			buildLoc = metadataLoc + "/build";
-			return createBuildDir(buildLoc);
-		} else {
-			File buildLocDir = new File(buildLoc);
-			if (!buildLocDir.exists()) {
-				return createBuildDir(buildLoc);
-			} else if (buildLocDir.isDirectory()) {
-				return createBuildDir(buildLoc);
-			} else {
-				return new Status(IStatus.ERROR, "not_used", 0, "Invalid build location: Make sure the build location is a directory!", null);
-			}
-		}
-	}
-
-	private Status createBuildDir(String buildLoc) {
-		String metadataDir = textMetadataLoc.getText();
-
-		// if we do  not change the directory to metadata location the script will be looked into the directory indicated by user.dir system property
-		// system.property usually points to the location from where eclipse was started
-		String createBuildDirCmd = "cd " + metadataDir + ";source " + metadataDir + "/oe-init-build-env " + buildLoc;
-
-		try {
-			ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", createBuildDirCmd});
-			Process proc = builder.start();
-			InputStream errorStream = proc.getErrorStream();
-			InputStreamReader isr = new InputStreamReader(errorStream);
-			BufferedReader br = new BufferedReader(isr);
-			String line = null;
-			String status = "";
-			while ( (line = br.readLine()) != null) {
-				status += line;
-			}
-
-			if (proc.waitFor() != 0)
-				return new Status(IStatus.ERROR, "not_used", 0, status, null);;
-			return new Status(IStatus.OK, "not_used", 0, "", null);
-		} catch (Exception e) {
-			return  new Status(IStatus.ERROR, "not_used", 0, e.getMessage(), null);
-		}
-	}
-
-	public YoctoBspElement getBSPElement() {
-		return this.bspElem;
-	}
-
-
-	private void resetKarchCombo() {
-		comboKArch.deselectAll();
-		comboQArch.deselectAll();
-		comboKArch.setEnabled(false);
-		labelQArch.setEnabled(false);
-		comboQArch.setEnabled(false);
-	}
-
-	private void kernelArchesHandler() {
-		BSPAction kArchesAction = getKArches();
-		if (kArchesAction.getMessage() == null && kArchesAction.getItems().length != 0) {
-			comboKArch.setItems(kArchesAction.getItems());
-			comboKArch.setEnabled(true);
-		} else if (kArchesAction.getMessage() != null){
-			setErrorMessage(kArchesAction.getMessage());
-			return;
-		}
-		BSPAction qArchesAction = getQArches();
-		if (qArchesAction.getMessage() == null && qArchesAction.getItems().length != 0) {
-			comboQArch.setItems(qArchesAction.getItems());
-		} else if (qArchesAction.getMessage() != null)
-			setErrorMessage(qArchesAction.getMessage());
-
-	}
-
-	@Override
-	public boolean canFlipToNextPage(){
-		String err = getErrorMessage();
-		if (err != null)
-			return false;
-		else if (!validatePage())
-			return false;
-		return true;
-	}
-
-
-	public boolean validatePage() {
-		String metadataLoc = textMetadataLoc.getText();
-		String bspname = textBspName.getText();
-		String karch = comboKArch.getText();
-		String qarch = comboQArch.getText();
-		if (metadataLoc.isEmpty() ||
-				bspname.isEmpty() ||
-				karch.isEmpty()) {
-			return false;
-		} else if (karch.matches("qemu") && qarch.isEmpty()) {
-			return false;
-		}
-
-		bspElem.setBspName(bspname);
-		if (!textBspOutputLoc.getText().isEmpty())
-			bspElem.setBspOutLoc(textBspOutputLoc.getText());
-		else
-			bspElem.setBspOutLoc("");
-		if (!textBuildLoc.getText().isEmpty()) {
-			checkBuildDir();
-			bspElem.setBuildLoc(textBuildLoc.getText());
-		} else {
-			bspElem.setBuildLoc(metadataLoc + "/build");
-			if (!buildDirChecked) {
-				checkBuildDir();
-				buildDirChecked = true;
-			}
-		}
-		bspElem.setMetadataLoc(metadataLoc);
-		bspElem.setKarch(karch);
-		bspElem.setQarch(qarch);
-
-
-		if (!bspElem.getValidPropertiesFile()) {
-			boolean validPropertiesFile = true;
-			BSPAction action = createPropertiesFile();
-			if (action.getMessage() != null) {
-				validPropertiesFile = false;
-				setErrorMessage(action.getMessage());
-			}
-			bspElem.setValidPropertiesFile(validPropertiesFile);
-		}
-		return true;
-	}
-
-	private BSPAction createPropertiesFile() {
-		String createPropertiesCmd = bspElem.getMetadataLoc() + "/scripts/" +
-				PROPERTIES_CMD_PREFIX + bspElem.getKarch() +
-				PROPERTIES_CMD_SURFIX + PROPERTIES_FILE;
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(),  new ErrorCollectorThread(createPropertiesCmd), "Creating properties file ");
-		progressDialog.run(false);
-		return progressDialog.getBspAction();
-	}
-
-	private BSPAction getKArches() {
-		String getKArchCmd = textMetadataLoc.getText() + "/scripts/" + KARCH_CMD;
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelArchGetter(getKArchCmd), "Loading kernel architectures ");
-		progressDialog.run(false);
-		return progressDialog.getBspAction();
-	}
-
-	private BSPAction getQArches() {
-		String getQArchCmd = textMetadataLoc.getText() + "/scripts/" + QARCH_CMD;
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new QemuArchGetter(getQArchCmd), "Loading Qemu architectures ");
-		progressDialog.run(false);
-		return progressDialog.getBspAction();
-	}
-
-	public Button getBtnMetadataLoc() {
-		return btnMetadataLoc;
-	}
-
-	public void setBtnMetadataLoc(Button btnMetadataLoc) {
-		this.btnMetadataLoc = btnMetadataLoc;
-	}
-
-	public Button getBtnBspOutLoc() {
-		return btnBspOutputLoc;
-	}
-
-	public void setBtnBspOutLoc(Button btnBspOutLoc) {
-		this.btnBspOutputLoc = btnBspOutLoc;
-	}
-
-	public Button getBtnBuilddirLoc() {
-		return btnBuildLoc;
-	}
-
-	public void setBtnBuilddirLoc(Button btnBuilddirLoc) {
-		this.btnBuildLoc = btnBuilddirLoc;
-	}
-
-	class BuildLocationListener implements FocusListener{
-		String value;
-		boolean changed;
-
-		BuildLocationListener(String value){
-			this.value = value;
-		}
-		@Override
-		public void focusGained(FocusEvent e) {
-			value = ((Text)e.getSource()).getText();
-		}
-
-		@Override
-		public void focusLost(FocusEvent e) {
-			if(!((Text)e.getSource()).getText().equals(value)) {
-				checkBuildDir();
-				buildDirChecked = true;
-			}
-		}
-
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java
deleted file mode 100644
index df5fba5..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * BSPThread that returns all the output lines of the process execution
- * @author ioana.grigoropol
- *
- */
-public class OutputCollectorThread extends BSPThread{
-
-	public OutputCollectorThread(String command) {
-		super(command);
-	}
-
-	@Override
-	protected String[] processLine(String line) {
-		return new String[]{SUCCESS, line};
-	}
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java
deleted file mode 100644
index 58ee11f..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java
+++ /dev/null
@@ -1,499 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.yocto.sdk.remotetools.YoctoBspElement;
-import org.yocto.sdk.remotetools.YoctoBspPropertyElement;
-import org.yocto.sdk.remotetools.YoctoJSONHelper;
-/**
- *
- * Setting up the parameters for creating the new Yocto BSP
- *
- * @author jzhang
- */
-public class PropertiesPage extends WizardPage {
-	private static final String PAGE_NAME = "Properties";
-	private static final String VALUES_CMD_PREFIX = "yocto-bsp list ";
-	private static final String VALUES_CMD_SURFIX = " property  ";
-	private static final String KERNEL_CHOICE = "kernel_choice";
-	private static final String DEFAULT_KERNEL = "use_default_kernel";
-	private static final String SMP_NAME = "smp";
-	private static final String EXISTING_KBRANCH_NAME = "existing_kbranch";
-	private static final String NEED_NEW_KBRANCH_NAME = "need_new_kbranch";
-	private static final String NEW_KBRANCH_NAME = "new_kbranch";
-	private static final String QARCH_NAME = "qemuarch";
-
-	private static final String KERNEL_CHOICES = "choices";
-	private static final String KERNEL_BRANCHES = "branches";
-
-	private Hashtable<YoctoBspPropertyElement, Control> propertyControlMap;
-	HashSet<YoctoBspPropertyElement> properties;
-
-	private ScrolledComposite composite;
-	private Composite controlContainer = null;
-
-	private YoctoBspElement bspElem = null;
-	private boolean kArchChanged = false;
-
-	private Combo kernelCombo;
-	private Combo branchesCombo;
-
-	private Button newBranchButton;
-	private Button existingBranchButton;
-
-	private Button smpButton;
-
-	private Group kGroup = null;
-	private Group kbGroup = null;
-//	private Group otherSettingsGroup = null;
-	private Group propertyGroup = null;
-
-	public PropertiesPage(YoctoBspElement element) {
-		super(PAGE_NAME, "yocto-bsp Properties page", null);
-		this.bspElem = element;
-	}
-
-	public void onEnterPage(YoctoBspElement element) {
-		if (!element.getValidPropertiesFile()) {
-			setErrorMessage("There's no valid properties file created, please choose \"Back\" to reselect kernel architecture!");
-			return;
-		}
-
-		if (this.bspElem == null || this.bspElem.getKarch().isEmpty() || !this.bspElem.getKarch().contentEquals(element.getKarch())) {
-			kArchChanged = true;
-		} else
-			kArchChanged = false;
-
-		this.bspElem = element;
-		try {
-			if (kArchChanged) {
-				updateKernelValues(KERNEL_CHOICES, KERNEL_CHOICE);
-				
-				if (propertyGroup != null) {
-					for (Control cntrl : propertyGroup.getChildren()) {
-						cntrl.dispose();
-					}
-				}
-
-				properties = YoctoJSONHelper.getProperties();
-
-				if (!properties.isEmpty()) {
-
-					if (!element.getQarch().isEmpty()) {
-						YoctoBspPropertyElement qarch_elem = new YoctoBspPropertyElement();
-						qarch_elem.setName(QARCH_NAME);
-						qarch_elem.setValue(element.getQarch());
-						properties.add(qarch_elem);
-					}
-
-					propertyControlMap = new Hashtable<YoctoBspPropertyElement, Control>();
-
-					ArrayList<YoctoBspPropertyElement> propertiesList = new ArrayList<YoctoBspPropertyElement>(properties);
-					Collections.sort(propertiesList, Collections.reverseOrder());
-
-					Iterator<YoctoBspPropertyElement> it = propertiesList.iterator();
-					Composite comp = new Composite(propertyGroup, SWT.FILL);
-					GridLayout layout = new GridLayout(2, false);
-					GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);
-					comp.setLayoutData(data);
-					comp.setLayout(layout);
-
-					while (it.hasNext()) {
-						// Get property
-						YoctoBspPropertyElement propElem = it.next();
-						String type = propElem.getType();
-						String name = propElem.getName();
-						if (type.contentEquals("edit")) {
-							new Label (propertyGroup, SWT.FILL).setText(name + ":");
-
-							Composite textContainer = new Composite(propertyGroup, SWT.NONE);
-							textContainer.setLayout(new GridLayout(1, false));
-							textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
-							Text text = new Text(textContainer, SWT.BORDER | SWT.SINGLE);
-							text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-							propertyControlMap.put(propElem, text);
-
-						} else if (type.contentEquals("boolean")) {
-							String default_value = propElem.getDefaultValue();
-							Composite labelContainer = new Composite(propertyGroup, SWT.NONE);
-							labelContainer.setLayout(new GridLayout(2, false));
-							labelContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, false, 2, 1));
-							Button button = new Button(propertyGroup, SWT.CHECK);
-							button.setText(name);
-							if (default_value.equalsIgnoreCase("y")) {
-								button.setSelection(true);
-							} else
-								button.setSelection(false);
-							propertyControlMap.put(propElem, button);
-						} else if (type.contentEquals("choicelist")) {
-							new Label (propertyGroup, SWT.NONE).setText(name + ":");
-
-							Composite textContainer = new Composite(propertyGroup, SWT.NONE);
-							textContainer.setLayout(new GridLayout(1, false));
-							textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
-							Combo combo = new Combo(textContainer, SWT.READ_ONLY);
-							combo.setLayout(new GridLayout(2, false));
-							combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-							combo.setItems(getBSPComboProperties(name));
-							propertyControlMap.put(propElem, combo);
-						}
-					}
-				}
-				composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
-				composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-				controlContainer.pack();
-				this.composite.layout(true, true);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-
-	}
-
-
-	@Override
-	public void createControl(Composite parent) {
-		this.composite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
-		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
-		GridLayout layout = new GridLayout(2, true);
-		this.composite.setLayout(layout);
-
-		gd= new GridData(SWT.FILL, SWT.FILL, true, false);
-		gd.horizontalSpan = 2;
-		this.composite.setLayoutData(gd);
-
-		setControl(this.composite);
-
-		controlContainer = new Composite(composite, SWT.NONE);
-		controlContainer.setLayout(new GridLayout(1, true));
-		controlContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
-		kGroup = new Group(controlContainer, SWT.FILL);
-		kGroup.setLayout(new GridLayout(2, false));
-		GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
-		kGroup.setLayoutData(data);
-		kGroup.setText("Kernel Settings:");
-
-		new Label (kGroup, SWT.NONE).setText("Kernel:");
-		Composite textContainer = new Composite(kGroup, SWT.NONE);
-		textContainer.setLayout(new GridLayout(1, false));
-		textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
-
-		kernelCombo = new Combo(textContainer, SWT.READ_ONLY);
-		kernelCombo.setLayout(new GridLayout(2, false));
-		kernelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
-		kernelCombo.addSelectionListener(new SelectionListener() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				controlChanged(e.widget);
-			}
-
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-		});
-
-		kbGroup = new Group(kGroup, SWT.FILL);
-		kbGroup.setLayout(new GridLayout(2, true));
-		data = new GridData(SWT.FILL, SWT.FILL, true, false);
-		data.horizontalSpan = 2;
-		kbGroup.setLayoutData(data);
-		kbGroup.setText("Branch Settings:");
-
-		textContainer = new Composite(kbGroup, SWT.NONE);
-		textContainer.setLayout(new GridLayout(2, false));
-		textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
-		
-		new Label(textContainer, SWT.NONE).setText("Kernel branch:");
-		
-		branchesCombo = new Combo(textContainer, SWT.READ_ONLY);
-		branchesCombo.setLayout(new GridLayout(1, false));
-		branchesCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-		branchesCombo.addSelectionListener(new SelectionListener() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				controlChanged(e.widget);
-			}
-
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-		});
-		branchesCombo.setSize(200, 200);
-		
-		newBranchButton = new Button(kbGroup, SWT.RADIO);
-		newBranchButton.setText("Create a new branch from an existing one");
-		newBranchButton.setSelection(true);
-		newBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-		SelectionListener listener = new SelectionListener() {
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				controlChanged(e.widget);
-			}
-		};
-
-		newBranchButton.addSelectionListener(listener);
-
-		existingBranchButton = new Button(kbGroup, SWT.RADIO);
-		existingBranchButton.setText("Use existing branch");
-		existingBranchButton.setSelection(false);
-		existingBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-		existingBranchButton.addSelectionListener(listener);
-
-//		otherSettingsGroup = new Group(controlContainer, SWT.FILL);
-//		otherSettingsGroup.setLayout(new GridLayout(2, true));
-//		data = new GridData(SWT.FILL, SWT.FILL, true, false);
-//		data.horizontalSpan = 2;
-//		otherSettingsGroup.setLayoutData(data);
-//		otherSettingsGroup.setText("Other Settings:");
-
-		smpButton = new Button(kGroup, SWT.CHECK);
-		smpButton.setText("Enable SMP support");
-		smpButton.setSelection(true);
-		
-		propertyGroup = new Group(controlContainer, SWT.NONE);
-		propertyGroup.setLayout(new GridLayout(2, false));
-		data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);
-		propertyGroup.setLayoutData(data);
-		propertyGroup.setText("BSP specific settings:");
-
-		this.composite.layout(true, true);
-
-		composite.setContent(controlContainer);
-		composite.setExpandHorizontal(true);
-		composite.setExpandVertical(true);
-		composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
-		controlContainer.pack();
-		composite.pack();
-	}
-
-	@Override
-	public boolean canFlipToNextPage() {
-		return false;
-	}
-
-	public HashSet<YoctoBspPropertyElement> getProperties() {
-		String kcSelection = kernelCombo.getText();
-		String kbSelection = branchesCombo.getText();
-		YoctoBspPropertyElement kcElement = new YoctoBspPropertyElement();
-		kcElement.setName(KERNEL_CHOICE);
-		kcElement.setValue(kcSelection);
-		properties.add(kcElement);
-		YoctoBspPropertyElement defaultElement = new YoctoBspPropertyElement();
-		defaultElement.setName(DEFAULT_KERNEL);
-		defaultElement.setValue("n");
-		properties.add(defaultElement);
-
-		YoctoBspPropertyElement smpElement = new YoctoBspPropertyElement();
-		smpElement.setName(SMP_NAME);
-		if (smpButton.getSelection())
-			smpElement.setValue("y");
-		else
-			smpElement.setValue("n");
-		properties.add(smpElement);
-
-		YoctoBspPropertyElement newKbElement = new YoctoBspPropertyElement();
-		YoctoBspPropertyElement kbElement = new YoctoBspPropertyElement();
-
-		newKbElement.setName(NEED_NEW_KBRANCH_NAME);
-		if (newBranchButton.getSelection()) {
-			newKbElement.setValue("y");
-			properties.add(newKbElement);
-			kbElement.setName(NEW_KBRANCH_NAME);
-			kbElement.setValue(kbSelection);
-			properties.add(kbElement);
-		} else {
-			newKbElement.setValue("n");
-			properties.add(newKbElement);
-			kbElement.setName(EXISTING_KBRANCH_NAME);
-			kbElement.setValue(kbSelection);
-			properties.add(kbElement);
-		}
-
-		return properties;
-	}
-
-	public boolean validatePage() {
-		if (kernelCombo == null)
-			return false;
-
-		if ((kernelCombo != null) && (branchesCombo != null)) {
-			String kcSelection = kernelCombo.getText();
-			String kbSelection = branchesCombo.getText();
-			if ((kcSelection == null) || (kbSelection == null) || (kcSelection.isEmpty()) || (kbSelection.isEmpty())) {
-				setErrorMessage("Please choose a kernel and a specific branch!");
-				return false;
-			}
-		}
-		if ((propertyControlMap != null)) {
-			if (!propertyControlMap.isEmpty()) {
-				Enumeration<YoctoBspPropertyElement> keys = propertyControlMap.keys();
-				while (keys.hasMoreElements()) {
-					YoctoBspPropertyElement key = keys.nextElement();
-					Control control = propertyControlMap.get(key);
-					String type = key.getType();
-
-					if (type.contentEquals("edit")) {
-						String text_value = ((Text)control).getText();
-						if (text_value == null) {
-							setErrorMessage("Field "+ key.getName() +" is not set.  All of the field on this screen must be set!");
-							return false;
-						} else {
-							key.setValue(text_value);
-						}
-					} else if (type.contentEquals("choicelist")) {
-						String choice_value = ((Combo)control).getText();
-						if (choice_value == null) {
-							setErrorMessage("Field "+ key.getName() +" is not set.  All of the field on this screen must be set!");
-							return false;
-						} else {
-							key.setValue(choice_value);
-						}
-					} else {
-						boolean button_select = ((Button)control).getSelection();
-						if (button_select)
-							key.setValue("y");
-						else
-							key.setValue("n");
-					}
-					updateProperties(key);
-				}
-			}
-		}
-		return true;
-	}
-
-	private void updateProperties(YoctoBspPropertyElement element) {
-		Iterator<YoctoBspPropertyElement> it = properties.iterator();
-
-		while (it.hasNext()) {
-			YoctoBspPropertyElement propElem = it.next();
-			if (propElem.getName().contentEquals(element.getName())) {
-				properties.remove(propElem);
-				properties.add(element);
-				break;
-			} else
-				continue;
-		}
-	}
-	private void controlChanged(Widget widget) {
-		setErrorMessage(null);
-
-		String kernel_choice = kernelCombo.getText();
-		if ((kernel_choice == null) || (kernel_choice.isEmpty())) {
-			setErrorMessage("Please choose kernel !");
-			return;
-		}
-		if (widget == kernelCombo) {
-			updateKernelValues(KERNEL_BRANCHES, "\\\"" + kernel_choice + "\\\"." + NEW_KBRANCH_NAME);
-		} else if (widget == branchesCombo) {
-			setErrorMessage(null);
-			branchesCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-		} else if (widget == newBranchButton || widget == existingBranchButton) {
-			if (newBranchButton.getSelection()) {
-				updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + NEW_KBRANCH_NAME);
-			} else {
-				updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + EXISTING_KBRANCH_NAME);
-			}
-			branchesCombo.deselectAll();
-		}
-		canFlipToNextPage();
-		getWizard().getContainer().updateButtons();
-		this.composite.layout(true, true);
-		composite.pack();
-	}
-
-	private void updateKernelValues(final String value, String property) {
-		@SuppressWarnings("unused")
-		String build_dir = "";
-		if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty())
-			build_dir = bspElem.getMetadataLoc()+"/build";
-		else
-			build_dir = bspElem.getBuildLoc();
-
-		String metadataLoc = bspElem.getMetadataLoc();
-		String valuesCmd = "source " + metadataLoc + "/oe-init-build-env;" + metadataLoc + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property;
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(),  new KernelBranchesGetter(valuesCmd), "Loading Kernel " + value);
-		if (value.equals(KERNEL_CHOICES))
-			progressDialog.run(false);
-		else if (value.equals(KERNEL_BRANCHES))
-			progressDialog.run(true);
-		
-		BSPAction action = progressDialog.getBspAction();
-		if (action.getItems() != null) {
-			if (value.equals(KERNEL_CHOICES)) {
-				kernelCombo.setItems(action.getItems());
-				kernelCombo.pack();
-				kernelCombo.deselectAll();
-				branchesCombo.setEnabled(false);
-				branchesCombo.deselectAll();
-			} else if (value.equals(KERNEL_BRANCHES)) {
-				branchesCombo.setItems(action.getItems());
-				branchesCombo.pack();
-				branchesCombo.setEnabled(true);
-			}
-			composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
-		} else if (action.getMessage() != null)
-			MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage());
-		composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
-	}
-
-	private String[] getBSPComboProperties(String property) {
-		String build_dir = "";
-		if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty())
-			build_dir = bspElem.getMetadataLoc()+"/build";
-		else
-			build_dir = bspElem.getBuildLoc();
-
-		String valuesCmd = "export BUILDDIR=" + build_dir + ";" + bspElem.getMetadataLoc() + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property;
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(),  new KernelBranchesGetter(valuesCmd), "Loading property " + property + "values");
-		progressDialog.run(false);
-		BSPAction action = progressDialog.getBspAction();
-
-		if (action.getItems() != null) {
-			return action.getItems();
-		} else if (action.getMessage() != null) {
-			MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage());
-			return new String[]{};
-		}
-		return new String[]{};
-	}
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java
deleted file mode 100644
index e235695..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-/**
- * BSPThread that processes the output of running "yocto-bsp list qemu property qemuarch"
- * @author ioana.grigoropol
- *
- */
-public class QemuArchGetter extends BSPThread {
-
-	public QemuArchGetter(String command) {
-		super(command);
-	}
-
-	@Override
-	protected String[] processLine(String line) {
-		if (!line.startsWith("["))
-			return new String[]{ERROR, line + "\n"};
-
-		String[] values = line.split(",");
-
-		String value = values[0];
-		value = value.replace("[\"", "");
-		value = value.replaceAll("\"$", "");
-		return new String[]{SUCCESS, value};
-	}
-
-}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java
deleted file mode 100644
index 3ab24c0..0000000
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Intel Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.remotetools.wizards.bsp;
-
-import java.util.HashSet;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.yocto.sdk.remotetools.YoctoBspElement;
-import org.yocto.sdk.remotetools.YoctoBspPropertyElement;
-import org.yocto.sdk.remotetools.YoctoJSONHelper;
-
-/**
- * A wizard for creating Yocto BSP.
- *
- * @author jzhang
- *
- */
-public class YoctoBSPWizard extends Wizard {
-	private static final String CREATE_CMD = "/scripts/yocto-bsp create ";
-	private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json";
-
-	private MainPage mainPage;
-	private PropertiesPage propertiesPage;
-	private final YoctoBspElement bspElem;
-
-	public YoctoBSPWizard() {
-		super();
-		bspElem = new YoctoBspElement();
-	}
-
-	@Override
-	public IWizardPage getNextPage(IWizardPage page) {
-		propertiesPage.onEnterPage(mainPage.getBSPElement());
-		return propertiesPage;
-	}
-
-	@Override
-	public void addPages() {
-		mainPage = new MainPage(bspElem);
-		addPage(mainPage);
-		propertiesPage = new PropertiesPage(bspElem);
-		addPage(propertiesPage);
-	}
-
-	private BSPAction createBSP(){
-		YoctoBspElement element = mainPage.getBSPElement();
-		String createBspCmd = element.getMetadataLoc() + CREATE_CMD +
-								element.getBspName() + " " + element.getKarch();
-
-		if (!element.getBspOutLoc().isEmpty())
-			createBspCmd = createBspCmd + " -o " + element.getBspOutLoc();
-		else
-			createBspCmd = createBspCmd + " -o " + element.getMetadataLoc() + "/meta-" + element.getBspName();
-		createBspCmd = createBspCmd + " -i " + PROPERTY_VALUE_FILE;
-
-		BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(),  new OutputCollectorThread(createBspCmd), "Creating BSP ");
-		progressDialog.run(true);
-		return progressDialog.getBspAction();
-	}
-
-	@Override
-	public boolean performFinish() {
-		if (propertiesPage.validatePage()) {
-			HashSet<YoctoBspPropertyElement> properties = propertiesPage.getProperties();
-			YoctoJSONHelper.createBspJSONFile(properties);
-
-			BSPAction createBSPAction = createBSP();
-			if (createBSPAction.getMessage() !=  null && !createBSPAction.getMessage().isEmpty()) {
-				MessageDialog.openError(getShell(),"Yocto-BSP", createBSPAction.getMessage());
-				return false;
-			} else {
-				String message = "";
-				for (String item : createBSPAction.getItems())
-					message += item + "\n";
-				MessageDialog.openInformation(getShell(), "Yocto-BSP", message);
-				return true;
-			}
-		} else {
-			MessageDialog.openError(getShell(), "Yocto-BSP", "Property settings contains error!");
-			return false;
-		}
-
-	}
-
-	@Override
-	public boolean canFinish() {
-		return (mainPage.validatePage() && propertiesPage.validatePage());
-	}
-}
-- 
2.7.4




More information about the eclipse-yocto mailing list