summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2012-09-20 14:01:43 (EDT)
committer Roland Grunberg2012-09-21 10:23:50 (EDT)
commitf4ce880b10d1859e7e4dbd4634fa6f1746e013dc (patch)
tree89838d2e524f6b69d875cb161c5ff02634e5c44a
parentd4f40089efaa7d8f004efa267e6874a6a6e84f92 (diff)
downloadorg.eclipse.linuxtools-f4ce880b10d1859e7e4dbd4634fa6f1746e013dc.zip
org.eclipse.linuxtools-f4ce880b10d1859e7e4dbd4634fa6f1746e013dc.tar.gz
org.eclipse.linuxtools-f4ce880b10d1859e7e4dbd4634fa6f1746e013dc.tar.bz2
Make sure a launch provider exists for a plug-in when using a plug-in id.
If a plug-in id is acquired from the preferences, it's possible that the plug-in corresponding to that id is not present. To prevent that, a simple check is done, given the plug-in id, to make sure the launch provider exists for the corresponding plug-in. Change-Id: I51b880a7a2e9aa3127604d1126411992d164de99 Reviewed-on: https://git.eclipse.org/r/7854 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchConfigurationDelegate.java5
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchShortcut.java8
2 files changed, 10 insertions, 3 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchConfigurationDelegate.java
index b43f889..9783b9e 100644
--- a/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchConfigurationDelegate.java
+++ b/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchConfigurationDelegate.java
@@ -61,10 +61,9 @@ public abstract class ProviderLaunchConfigurationDelegate extends
*/
public static String getProviderIdToRun(String type) {
// Look in the preferences for a provider
- String providerId = ConfigurationScope.INSTANCE.getNode(
- type).get(
+ String providerId = ConfigurationScope.INSTANCE.getNode(type).get(
AbstractProviderPreferencesPage.PREFS_KEY, "");
- if (providerId.equals("")) {
+ if (providerId.equals("") || getConfigurationDelegateFromId(providerId) == null) {
// Get highest priority provider
providerId = ProfileLaunchConfigurationTabGroup
.getHighestProviderId(type);
diff --git a/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchShortcut.java
index e048d9f..323f601 100644
--- a/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchShortcut.java
+++ b/profiling/org.eclipse.linuxtools.profiling.provider/src/org/eclipse/linuxtools/internal/profiling/provider/launch/ProviderLaunchShortcut.java
@@ -33,6 +33,14 @@ public abstract class ProviderLaunchShortcut extends ProfileLaunchShortcut {
@Override
protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
+ String type = getProfilingType();
+
+ // check that there exists a provider for the given profiling type
+ if (ProviderLaunchConfigurationDelegate.getProviderIdToRun(type) == null) {
+ handleFail(Messages.ProviderLaunchShortcut_0 + " " + type);
+ return null;
+ }
+
// create a launch configuration based on the shortcut
ILaunchConfiguration config = createConfiguration(bin, false);
boolean exists = false;