Skip to contentSkip to conversation

Fix Launching Hob command

PATCH In review Ioana Grigoropol 2 participants 2 messages Jan 24, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix Launching Hob command

---
 .../org/yocto/bc/ui/actions/LaunchHobAction.java   |   23 +++++++++-----------
 .../bc/ui/builder/BitbakeCommanderNature.java      |   20 ++++++++++-------
 2 files changed, 22 insertions(+), 21 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java +10 -13
index e92fac0..dbbd3cd 100644
@@ -10,26 +10,23 @@
  *******************************************************************************/
 package org.yocto.bc.ui.actions;
 
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
-
 import org.eclipse.swt.widgets.Shell;
-
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.yocto.bc.ui.builder.BitbakeCommanderNature;
 
 
 public class LaunchHobAction  {
     private static final String DIALOG_TITLE  = "Launch HOB";
-	
+
 	public void run(IAction action) {
 		IResource resource = getSelectedResource();
 		if (resource == null)
@@ -39,21 +36,21 @@ public class LaunchHobAction  {
 		LaunchHobDialog hobDialog = new LaunchHobDialog(new Shell(), DIALOG_TITLE, project);
 		hobDialog.open();
 		String buildDir = hobDialog.getBuildDir();
-	
-		if (buildDir != null) {			
+
+		if (buildDir != null) {
 			try {
 				BitbakeCommanderNature.launchHob(project,buildDir);
 			} catch (Exception e){
-				System.out.println(e.getMessage());
+				e.printStackTrace();
 			}
 		}
-		
+
 	}
 
 	public void dispose() {
 
 	}
-	
+
 	private IResource getSelectedResource() {
 		IWorkbench iworkbench = PlatformUI.getWorkbench();
 		if (iworkbench == null){
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java +12 -8
index fe2a997..dbd489d 100644
@@ -36,29 +36,30 @@ public class BitbakeCommanderNature implements IProjectNature {
 	public static void launchHob(IProject project, String buildDir) {
 		try {
 			ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
-			ILaunchConfigurationType configType = 
+			ILaunchConfigurationType configType =
 				lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
 			ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "hob");
 			ArrayList<String> listValue = new ArrayList<String>();
 			listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
-			w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);		
+			w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
 			w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");
 
-			String init_script = project.getLocation().toString() + "/oe-init-build-env ";
+			String init_script = project.getLocationURI().getPath() + "/oe-init-build-env ";
 			String argument = "-e \"source " + init_script + buildDir + ";hob";// + ";bash\"";
 
 			w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
 			w_copy.launch(ILaunchManager.RUN_MODE, null);
-			
+
 		} catch (CoreException e) {
 			System.out.println(e.getMessage());
 		}
 	}
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.eclipse.core.resources.IProjectNature#configure()
 	 */
+	@Override
 	public void configure() throws CoreException {
 		IProjectDescription desc = project.getDescription();
 		ICommand[] commands = desc.getBuildSpec();
@@ -80,9 +81,10 @@ public class BitbakeCommanderNature implements IProjectNature {
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.eclipse.core.resources.IProjectNature#deconfigure()
 	 */
+	@Override
 	public void deconfigure() throws CoreException {
 		IProjectDescription description = getProject().getDescription();
 		ICommand[] commands = description.getBuildSpec();
@@ -100,18 +102,20 @@ public class BitbakeCommanderNature implements IProjectNature {
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.eclipse.core.resources.IProjectNature#getProject()
 	 */
+	@Override
 	public IProject getProject() {
 		return project;
 	}
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
 	 */
+	@Override
 	public void setProject(IProject project) {
 		this.project = project;
 	}
Signature · 1 line
1.7.9.5
#1 lore raw

Merged to Eclipse windows-build branch.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ioana Grigoropol
Sent: Thursday, January 24, 2013 4:49 AM
To: [email protected]
Subject: [yocto] [PATCH] [eclipse-poky][branch:windows-build]Fix Launching Hob command

---
 .../org/yocto/bc/ui/actions/LaunchHobAction.java   |   23 +++++++++-----------
 .../bc/ui/builder/BitbakeCommanderNature.java      |   20 ++++++++++-------
 2 files changed, 22 insertions(+), 21 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobActio renamed from plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java +0 -0
index e92fac0..dbbd3cd 100644

+++ n.java
@@ -10,26 +10,23 @@
*******************************************************************************/
package org.yocto.bc.ui.actions;

-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection;
-
import org.eclipse.swt.widgets.Shell;
-
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow; import +org.eclipse.ui.PlatformUI;
import org.yocto.bc.ui.builder.BitbakeCommanderNature;

 public class LaunchHobAction  {
     private static final String DIALOG_TITLE  = "Launch HOB";
-
+
        public void run(IAction action) {
                IResource resource = getSelectedResource();
                if (resource == null)
@@ -39,21 +36,21 @@ public class LaunchHobAction  {
                LaunchHobDialog hobDialog = new LaunchHobDialog(new Shell(), DIALOG_TITLE, project);
                hobDialog.open();
                String buildDir = hobDialog.getBuildDir();
-
-               if (buildDir != null) {
+
+               if (buildDir != null) {
                        try {
                                BitbakeCommanderNature.launchHob(project,buildDir);
                        } catch (Exception e){
-                               System.out.println(e.getMessage());
+                               e.printStackTrace();
                        }
                }
-
+
        }

        public void dispose() {

        }
-
+
        private IResource getSelectedResource() {
                IWorkbench iworkbench = PlatformUI.getWorkbench();
                if (iworkbench == null){
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommand renamed from plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java +0 -0
index fe2a997..dbd489d 100644

+++ erNature.java

@@ -36,29 +36,30 @@ public class BitbakeCommanderNature implements IProjectNature {
        public static void launchHob(IProject project, String buildDir) {
                try {
                        ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
-                       ILaunchConfigurationType configType =
+                       ILaunchConfigurationType configType =
                                lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
                        ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "hob");
                        ArrayList<String> listValue = new ArrayList<String>();
                        listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
-                       w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
+                       w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups",
+listValue);
                        w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");

- String init_script = project.getLocation().toString() + "/oe-init-build-env ";
+ String init_script = project.getLocationURI().getPath() +

+"/oe-init-build-env ";
                        String argument = "-e \"source " + init_script + buildDir + ";hob";// + ";bash\"";

                        w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
                        w_copy.launch(ILaunchManager.RUN_MODE, null);
-
+
                } catch (CoreException e) {
                        System.out.println(e.getMessage());
                }
        }
        /*
         * (non-Javadoc)

- *
+ *
* @see org.eclipse.core.resources.IProjectNature#configure() */
+ @Override

        public void configure() throws CoreException {
                IProjectDescription desc = project.getDescription();
                ICommand[] commands = desc.getBuildSpec(); @@ -80,9 +81,10 @@ public class BitbakeCommanderNature implements IProjectNature {

        /*
         * (non-Javadoc)

- *
+ *
* @see org.eclipse.core.resources.IProjectNature#deconfigure() */
+ @Override

        public void deconfigure() throws CoreException {
                IProjectDescription description = getProject().getDescription();
                ICommand[] commands = description.getBuildSpec(); @@ -100,18 +102,20 @@ public class BitbakeCommanderNature implements IProjectNature {

        /*
         * (non-Javadoc)

- *
+ *
* @see org.eclipse.core.resources.IProjectNature#getProject() */
+ @Override

        public IProject getProject() {
                return project;
        }

        /*
         * (non-Javadoc)

- *
+ *
* @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject) */
+ @Override

        public void setProject(IProject project) {
                this.project = project;
        }

--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto