From 8d7470a3de4927d67f14dbea8f47d4dba03d1ec0 Mon Sep 17 00:00:00 2001 From: "hyunsik.noh" Date: Mon, 6 May 2013 19:52:44 +0900 Subject: [PATCH] [Title]Change Oprofile/valgrindShortcut to implement IGomSmartLaunchShortcut [Type] [Module]profiler [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] Change-Id: Ia05369766c9e9dc7a1644781155122bebaa09302 --- .../META-INF/MANIFEST.MF | 1 + .../launch/NormalOprofileLaunchShortcut.java | 29 ++++++++++++---------- .../META-INF/MANIFEST.MF | 1 + .../profiling/launch/ProfileLaunchShortcut.java | 5 ++-- .../META-INF/MANIFEST.MF | 1 + .../valgrind/launch/ValgrindLaunchShortcut.java | 28 ++++++++++++--------- 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/org.eclipse.linuxtools.oprofile.launch.exe/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.oprofile.launch.exe/META-INF/MANIFEST.MF index 2fef63d..44f9fc9 100644 --- a/org.eclipse.linuxtools.oprofile.launch.exe/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.oprofile.launch.exe/META-INF/MANIFEST.MF @@ -23,6 +23,7 @@ Import-Package: org.eclipse.cdt.debug.core, org.eclipse.linuxtools.oprofile.ui, org.eclipse.linuxtools.oprofile.ui.view, org.eclipse.ui, + org.tizen.common.gom.launch, org.tizen.nativecommon.launch, org.tizen.nativecommon.launch.ui, org.tizen.sdblib diff --git a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/NormalOprofileLaunchShortcut.java b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/NormalOprofileLaunchShortcut.java index 79fb36f..facc963 100644 --- a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/NormalOprofileLaunchShortcut.java +++ b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/NormalOprofileLaunchShortcut.java @@ -20,11 +20,11 @@ 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()); + } + }); } - } diff --git a/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF index dd33548..8f0f74d 100644 --- a/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF @@ -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, diff --git a/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java b/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java index 3683be4..a2fe876 100644 --- a/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java +++ b/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java @@ -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(); } - } diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.valgrind.launch.exe/META-INF/MANIFEST.MF index b7122bd..abad1ae 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.valgrind.launch.exe/META-INF/MANIFEST.MF @@ -21,6 +21,7 @@ Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.launch.exe;singleton:=true Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.linuxtools.valgrind.launch Import-Package: org.eclipse.cdt.managedbuilder.core, + org.tizen.common.gom.launch, org.tizen.nativecommon.launch, org.tizen.nativecommon.launch.ui, org.tizen.sdblib diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java index 3d66dfc..80e9787 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java +++ b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java @@ -21,20 +21,22 @@ 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()); + } + }); } } -- 2.7.4