Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorDoug Schaefer2007-05-04 13:19:18 +0000
committerDoug Schaefer2007-05-04 13:19:18 +0000
commita0b8eefc605b41ce6703750e4c8c0e04fbc76c30 (patch)
tree53b23c9ff63278ef4bfbb7a5099e9f47d0b8d579 /launch
parentb2f48c45c9e3565a6652493482f505c1d62766a9 (diff)
downloadorg.eclipse.cdt-a0b8eefc605b41ce6703750e4c8c0e04fbc76c30.tar.gz
org.eclipse.cdt-a0b8eefc605b41ce6703750e4c8c0e04fbc76c30.tar.xz
org.eclipse.cdt-a0b8eefc605b41ce6703750e4c8c0e04fbc76c30.zip
Change shortcut context launch enablement to be true for executables and C projects.
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/plugin.xml18
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CPropertyTester.java41
2 files changed, 28 insertions, 31 deletions
diff --git a/launch/org.eclipse.cdt.launch/plugin.xml b/launch/org.eclipse.cdt.launch/plugin.xml
index e0672588dd0..22841d6b411 100644
--- a/launch/org.eclipse.cdt.launch/plugin.xml
+++ b/launch/org.eclipse.cdt.launch/plugin.xml
@@ -80,11 +80,17 @@
<enablement>
<with variable="selection">
<count value="1"/>
- <iterate>
- <or>
- <test property="org.eclipse.cdt.launch.isCElement"/>
- <instanceof value="org.eclipse.cdt.internal.core.model.CProject"/>
- </or>
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <or>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable"/>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject"/>
+ </or>
</iterate>
</with>
</enablement>
@@ -110,7 +116,7 @@
<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
namespace="org.eclipse.cdt.launch"
- properties="isCElement"
+ properties="isExecutable,isCProject"
type="org.eclipse.core.runtime.IAdaptable"
class="org.eclipse.cdt.launch.internal.CPropertyTester"
id="org.eclipse.cdt.launch.CPropertyTester">
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CPropertyTester.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CPropertyTester.java
index 9d85b63de6a..e048fc2e561 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CPropertyTester.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CPropertyTester.java
@@ -14,7 +14,9 @@ package org.eclipse.cdt.launch.internal;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
@@ -23,35 +25,15 @@ import org.eclipse.core.runtime.IAdaptable;
*/
public class CPropertyTester extends PropertyTester {
- /* (non-Javadoc)
- * @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 ("isCElement".equals(property)) { //$NON-NLS-1$
- return isCElement(receiver);
- }
- if ("isExecutable".equals(property)) { //$NON-NLS-1$
+ if ("isExecutable".equals(property)) //$NON-NLS-1$
return isExecutable(receiver);
- }
- return false;
+ else if ("isCProject".equals(property)) //$NON-NLS-1$
+ return isCProject(receiver);
+ else
+ return false;
}
- private boolean isCElement(Object receiver) {
- ICElement celement = null;
- if (receiver instanceof IAdaptable) {
- IResource res = (IResource) ((IAdaptable)receiver).getAdapter(IResource.class);
- if (res != null) {
- celement = CoreModel.getDefault().create(res);
- }
- }
- return (celement != null);
- }
-
- /**
- * Look for executable.
- * @return true if the target resource has a <code>main</code> method,
- * <code>false</code> otherwise.
- */
private boolean isExecutable(Object receiver) {
ICElement celement = null;
if (receiver instanceof IAdaptable) {
@@ -63,4 +45,13 @@ public class CPropertyTester extends PropertyTester {
return (celement != null && celement instanceof IBinary);
}
+ private boolean isCProject(Object receiver) {
+ if (receiver instanceof IProject)
+ return CoreModel.hasCNature((IProject)receiver);
+ else if (receiver instanceof ICProject)
+ return true;
+ else
+ return false;
+ }
+
}

Back to the top