[yocto] [PATCH 2/3] Fix Bitbake commander project wizard

Ioana Grigoropol ioanax.grigoropol at intel.com
Mon Nov 26 03:04:56 PST 2012


- do not run git task in a loop
- wait for the command to finish - use ModalContext.allowReadAndDispatch(false) - (needs some fixes for upstream RSE API - TBA)

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol at intel.com>
---
 .../yocto/bc/ui/wizards/install/InstallWizard.java |   27 ++++++++++----------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
index dd2074c..d780cbf 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
@@ -9,6 +9,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.ptp.remote.core.IRemoteConnection;
@@ -114,12 +115,12 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
 				
 			if (((Boolean)options.get(GIT_CLONE)).booleanValue()) {
 				String[] cmd = {"/usr/bin/git clone --progress", "git://git.yoctoproject.org/poky.git", uri.getPath()};
+//				String[] cmd = {"md5sum /home/builder/socks-gw"};
 				LongtimeRunningTask runningTask = new LongtimeRunningTask("Checking out Yocto git repository", cmd, 
 						((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)), 
 						((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE)));
+				ModalContext.setAllowReadAndDispatch(false);
 				this.getContainer().run(false, false, runningTask);
-//				while (!runningTask.isFinished)
-//					Thread.sleep(2);
 			}
 			
 			CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(RemoteHelper.getRemoteConnectionByName(((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)).getName()));
@@ -183,7 +184,7 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
 
 		synchronized public void run(IProgressMonitor monitor) 
 				throws InvocationTargetException, InterruptedException {
-			boolean cancel = false;
+//			boolean cancel = false;
 			try {
 				monitor.beginTask(taskName, TOTALWORKLOAD);
 				
@@ -203,17 +204,17 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
 				for (int i = 1; i < cmdArray.length; i++)
 					args += cmdArray[i] + " ";
 				try {
-					while (!cancel) {
-	                    if(monitor.isCanceled()) {
-	                            cancel=true;
-	                            throw new InterruptedException("User Cancelled");
-	                    }
-	                    boolean hasErrors = RemoteHelper.runCommandRemote(RemoteHelper.getRemoteConnectionByName(connection.getName()), new YoctoCommand(cmdArray[0], "", args), monitor);
-	                    if (hasErrors)
-	                    	break;
+//					while (!cancel) {
+//	                    if(monitor.isCanceled()) {
+//	                            cancel=true;
+//	                            throw new InterruptedException("User Cancelled");
+//	                    }
+	                    RemoteHelper.runCommandRemote(RemoteHelper.getRemoteConnectionByName(connection.getName()), new YoctoCommand(cmdArray[0], "", args), monitor);
+//	                    if (hasErrors)
+//	                    	break;
 	                    
-	                    Thread.sleep(5000);
-					}
+//	                    Thread.sleep(5000);
+//					}
 				} catch (Exception e) {
 					e.printStackTrace();
 				} finally {
-- 
1.7.9.5




More information about the yocto mailing list