Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.core')
-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
4 files changed, 72 insertions, 2 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>

Back to the top