mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Modified to launch on a project context.
This commit is contained in:
parent
86f509df7b
commit
55a8f89f92
2 changed files with 18 additions and 3 deletions
|
@ -82,7 +82,7 @@
|
||||||
<count value="1"/>
|
<count value="1"/>
|
||||||
<iterate>
|
<iterate>
|
||||||
<or>
|
<or>
|
||||||
<test property="org.eclipse.cdt.launch.isExecutable"/>
|
<test property="org.eclipse.cdt.launch.isCElement"/>
|
||||||
<instanceof value="org.eclipse.cdt.internal.core.model.CProject"/>
|
<instanceof value="org.eclipse.cdt.internal.core.model.CProject"/>
|
||||||
</or>
|
</or>
|
||||||
</iterate>
|
</iterate>
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
<extension point="org.eclipse.core.expressions.propertyTesters">
|
<extension point="org.eclipse.core.expressions.propertyTesters">
|
||||||
<propertyTester
|
<propertyTester
|
||||||
namespace="org.eclipse.cdt.launch"
|
namespace="org.eclipse.cdt.launch"
|
||||||
properties="isExecutable"
|
properties="isCElement"
|
||||||
type="org.eclipse.core.runtime.IAdaptable"
|
type="org.eclipse.core.runtime.IAdaptable"
|
||||||
class="org.eclipse.cdt.launch.internal.CPropertyTester"
|
class="org.eclipse.cdt.launch.internal.CPropertyTester"
|
||||||
id="org.eclipse.cdt.launch.CPropertyTester">
|
id="org.eclipse.cdt.launch.CPropertyTester">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial implementation
|
* IBM Corporation - initial implementation
|
||||||
|
* Ken Ryall (Nokia) - Modified to launch on a project context.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launch.internal;
|
package org.eclipse.cdt.launch.internal;
|
||||||
|
|
||||||
|
@ -26,12 +27,26 @@ public class CPropertyTester extends PropertyTester {
|
||||||
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
|
* @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) {
|
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 isExecutable(receiver);
|
||||||
}
|
}
|
||||||
return false;
|
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.
|
* Look for executable.
|
||||||
* @return true if the target resource has a <code>main</code> method,
|
* @return true if the target resource has a <code>main</code> method,
|
||||||
|
|
Loading…
Add table
Reference in a new issue