Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java25
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchablePropertyTester.java34
-rw-r--r--org.eclipse.debug.core/plugin.xml12
-rw-r--r--org.eclipse.debug.ui/plugin.xml6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java24
6 files changed, 77 insertions, 27 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 868409b6b..efab904b1 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Export-Package: org.eclipse.debug.core,
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)";visibility:=reexport,
org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)"
+ org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)"
Eclipse-LazyStart: true
Import-Package: com.ibm.icu.text
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index a0a987a47..df9cda6e6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -686,6 +686,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* and values are associated configuration elements.
*/
private Map sourcePathComputers;
+
+ private Set fActiveModes;
/**
* @see ILaunchManager#addLaunch(ILaunch)
@@ -2570,4 +2572,25 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fos.close();
}
+ /**
+ * Returns whether any launch config supports the given mode.
+ *
+ * @param mode launch mode
+ * @return whether any launch config supports the given mode
+ */
+ public synchronized boolean launchModeAvailable(String mode) {
+ if (fActiveModes == null) {
+ ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
+ ILaunchMode[] modes = getLaunchModes();
+ fActiveModes = new HashSet(3);
+ for (int i = 0; i < types.length; i++) {
+ for (int j = 0; j < modes.length; j++) {
+ if (types[i].supportsMode(modes[j].getIdentifier())) {
+ fActiveModes.add(modes[j].getIdentifier());
+ }
+ }
+ }
+ }
+ return fActiveModes.contains(mode);
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchablePropertyTester.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchablePropertyTester.java
new file mode 100644
index 000000000..9c0fc184c
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchablePropertyTester.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.core;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugPlugin;
+
+/**
+ * Tests if an object is launchable.
+ */
+public class LaunchablePropertyTester extends PropertyTester {
+
+ /**
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if ("launchable".equals(property)) { //$NON-NLS-1$
+ if (((LaunchManager)(DebugPlugin.getDefault().getLaunchManager())).launchModeAvailable((String)expectedValue)) {
+ return Platform.getAdapterManager().hasAdapter(receiver, "org.eclipse.debug.ui.actions.ILaunchable");
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index 75fc4a97d..e9ded979a 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -167,4 +167,16 @@
</initializer>
</extension>
+<!-- ===================================== -->
+<!-- property testers -->
+<!-- ===================================== -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ namespace="org.eclipse.debug.core"
+ properties="launchable"
+ type="java.lang.Object"
+ class="org.eclipse.debug.internal.core.LaunchablePropertyTester"
+ id="org.eclipse.debug.core.propertyTesters.launchable">
+ </propertyTester>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index f52220fd2..5531c542a 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -883,7 +883,7 @@
id="org.eclipse.debug.ui.contextualLaunch.profile.submenu">
</action>
<enablement>
- <test property="org.eclipse.debug.ui.launchable" value="profile"/>
+ <test property="org.eclipse.debug.core.launchable" value="profile"/>
</enablement>
</objectContribution>
<objectContribution
@@ -898,7 +898,7 @@
id="org.eclipse.debug.ui.contextualLaunch.debug.submenu">
</action>
<enablement>
- <test property="org.eclipse.debug.ui.launchable" value="debug"/>
+ <test property="org.eclipse.debug.core.launchable" value="debug"/>
</enablement>
</objectContribution>
<objectContribution
@@ -913,7 +913,7 @@
id="org.eclipse.debug.ui.contextualLaunch.run.submenu">
</action>
<enablement>
- <test property="org.eclipse.debug.ui.launchable" value="run"/>
+ <test property="org.eclipse.debug.core.launchable" value="run"/>
</enablement>
</objectContribution>
<!-- console additions -->
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index 7338eca88..0bbc12b24 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,7 +53,6 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.debug.core.ILaunchListener;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.debug.internal.ui.DebugPluginImages;
@@ -180,12 +179,6 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* true when restoring launch history
*/
protected boolean fRestoring = false;
-
- /**
- * A set containing the launch modes supported by
- * current configurations.
- */
- private Set fLoadedModes = null;
/**
* The name of the file used to persist the launch history.
@@ -213,20 +206,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* @return whether any launch config supports the given mode
*/
public boolean launchModeAvailable(String mode) {
- if (fLoadedModes == null) {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType[] types = launchManager.getLaunchConfigurationTypes();
- ILaunchMode[] modes = launchManager.getLaunchModes();
- fLoadedModes = new HashSet(3);
- for (int i = 0; i < types.length; i++) {
- for (int j = 0; j < modes.length; j++) {
- if (types[i].supportsMode(modes[j].getIdentifier())) {
- fLoadedModes.add(modes[j].getIdentifier());
- }
- }
- }
- }
- return fLoadedModes.contains(mode);
+ return ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).launchModeAvailable(mode);
}
/**

Back to the top