[Title]Change Oprofile/valgrindShortcut to implement IGomSmartLaunchShortcut
authorhyunsik.noh <hyunsik.noh@samsung.com>
Mon, 6 May 2013 10:52:44 +0000 (19:52 +0900)
committerhyunsik.noh <hyunsik.noh@samsung.com>
Mon, 6 May 2013 10:52:44 +0000 (19:52 +0900)
[Type]
[Module]profiler
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]

Change-Id: Ia05369766c9e9dc7a1644781155122bebaa09302

org.eclipse.linuxtools.oprofile.launch.exe/META-INF/MANIFEST.MF
org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/NormalOprofileLaunchShortcut.java
org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF
org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java
org.eclipse.linuxtools.valgrind.launch.exe/META-INF/MANIFEST.MF
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java

index 2fef63d..44f9fc9 100644 (file)
@@ -23,6 +23,7 @@ Import-Package: org.eclipse.cdt.debug.core,
  org.eclipse.linuxtools.oprofile.ui,\r
  org.eclipse.linuxtools.oprofile.ui.view,\r
  org.eclipse.ui,\r
+ org.tizen.common.gom.launch,\r
  org.tizen.nativecommon.launch,\r
  org.tizen.nativecommon.launch.ui,\r
  org.tizen.sdblib\r
index 79fb36f..facc963 100644 (file)
 
 package org.tizen.oprofile.launch;
 
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchMessages;
@@ -33,7 +33,9 @@ import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
 import org.eclipse.linuxtools.profiling.launch.ProfileLaunchPlugin;
 import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
 import org.eclipse.ui.IEditorPart;
-import org.tizen.nativecommon.launch.ui.shortcut.ITizenProfileLaunchShortcut;
+import org.tizen.common.gom.launch.GomLaunchData;
+import org.tizen.common.gom.launch.IGomSmartLaunchShortcut;
+import org.tizen.common.util.SWTUtil;
 
 
 /**
@@ -41,7 +43,7 @@ import org.tizen.nativecommon.launch.ui.shortcut.ITizenProfileLaunchShortcut;
  *   shortcut, where the ProfileLaunchShortcut has the logic to automatically
  *   find binaries and create a default launch if one doesn't exist.
  */
-public class NormalOprofileLaunchShortcut extends ProfileLaunchShortcut implements ITizenProfileLaunchShortcut{
+public class NormalOprofileLaunchShortcut extends ProfileLaunchShortcut implements IGomSmartLaunchShortcut {
        
        public void launch(IEditorPart editor, String mode) {
                int targetResult = ProfileLaunchPlugin.checkTarget();
@@ -92,14 +94,15 @@ public class NormalOprofileLaunchShortcut extends ProfileLaunchShortcut implemen
 //             wc.setAttribute(ISMLCDTLaunchConstants.ATTR_SKIP_DOWNLOAD, false);
                wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
        }
-
-    @Override
-    public void profileLaunch(IBinary bin, String mode) {
-        super.launch(bin, mode);
-    }
-
-    @Override
-    public void profileLaunch(IProject project, String mode) {
+       
+       public void smartLaunch(final GomLaunchData data) {
+        final ILaunchConfiguration configuration = createConfiguration(data.getProject(), data.getMode());
+        SWTUtil.syncExec(new Runnable()
+        {
+            @Override
+            public void run() {
+                DebugUITools.launch(configuration, data.getMode());
+            }
+        });
     }
-
 }
index dd33548..8f0f74d 100644 (file)
@@ -23,6 +23,7 @@ Import-Package: org.eclipse.cdt.core,
  org.eclipse.debug.core,
  org.eclipse.debug.ui,
  org.eclipse.debug.ui.sourcelookup,
+ org.tizen.common.gom.launch,
  org.tizen.nativecommon,
  org.tizen.nativecommon.build,
  org.tizen.nativecommon.launch,
index 3683be4..a2fe876 100644 (file)
@@ -62,8 +62,8 @@ import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.eclipse.ui.dialogs.TwoPaneElementSelector;
 import org.tizen.common.util.ViewUtil;
 import org.tizen.nativecommon.ProjectUtil;
-import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.nativecommon.launch.LaunchUtils;
+import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.sdblib.IDevice;
 
 
@@ -219,7 +219,7 @@ public static void showErrorDialog(final String errorMessage, final String reaso
                return config;
        }
 
-       private ILaunchConfiguration createConfiguration(IProject prj, String mode) {
+       protected ILaunchConfiguration createConfiguration(IProject prj, String mode) {
            ILaunchConfiguration config = null;
            try {
                String projectName = prj.getName();
@@ -409,5 +409,4 @@ public static void showErrorDialog(final String errorMessage, final String reaso
        protected Shell getActiveWorkbenchShell() {
                return ProfileLaunchPlugin.getActiveWorkbenchShell();
        }
-
 }
index b7122bd..abad1ae 100644 (file)
@@ -21,6 +21,7 @@ Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.launch.exe;singleton:=true
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6\r
 Export-Package: org.eclipse.linuxtools.valgrind.launch\r
 Import-Package: org.eclipse.cdt.managedbuilder.core,\r
+ org.tizen.common.gom.launch,\r
  org.tizen.nativecommon.launch,\r
  org.tizen.nativecommon.launch.ui,\r
  org.tizen.sdblib\r
index 3d66dfc..80e9787 100644 (file)
 
 package org.eclipse.linuxtools.valgrind.launch;
 
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.linuxtools.profiling.launch.ProfileLaunchPlugin;
 import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
 import org.eclipse.ui.IEditorPart;
-import org.tizen.nativecommon.launch.ui.shortcut.ITizenProfileLaunchShortcut;
+import org.tizen.common.gom.launch.GomLaunchData;
+import org.tizen.common.gom.launch.IGomSmartLaunchShortcut;
+import org.tizen.common.util.SWTUtil;
 
 
-public class ValgrindLaunchShortcut extends ProfileLaunchShortcut implements ITizenProfileLaunchShortcut{
+public class ValgrindLaunchShortcut extends ProfileLaunchShortcut implements IGomSmartLaunchShortcut {
        private boolean canInitialize; //bery 20090715
        
        public void launch(IEditorPart editor, String mode) {
@@ -111,13 +113,15 @@ public class ValgrindLaunchShortcut extends ProfileLaunchShortcut implements ITi
        public boolean isCanInitialize() {
                return canInitialize;
        }
-
-    @Override
-    public void profileLaunch(IBinary bin, String mode) {
-        super.launch(bin, mode);
-    }
-
-    @Override
-    public void profileLaunch(IProject project, String mode) {
+       
+       public void smartLaunch(final GomLaunchData data) {
+        final ILaunchConfiguration configuration = super.createConfiguration(data.getProject(), data.getMode());
+        SWTUtil.syncExec(new Runnable()
+        {
+            @Override
+            public void run() {
+                DebugUITools.launch(configuration, data.getMode());
+            }
+        });
     }
 }