mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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"/>
|
||||
<iterate>
|
||||
<or>
|
||||
<test property="org.eclipse.cdt.launch.isExecutable"/>
|
||||
<test property="org.eclipse.cdt.launch.isCElement"/>
|
||||
<instanceof value="org.eclipse.cdt.internal.core.model.CProject"/>
|
||||
</or>
|
||||
</iterate>
|
||||
|
@ -107,7 +107,7 @@
|
|||
<extension point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
namespace="org.eclipse.cdt.launch"
|
||||
properties="isExecutable"
|
||||
properties="isCElement"
|
||||
type="org.eclipse.core.runtime.IAdaptable"
|
||||
class="org.eclipse.cdt.launch.internal.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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial implementation
|
||||
* Ken Ryall (Nokia) - Modified to launch on a project context.
|
||||
*******************************************************************************/
|
||||
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)
|
||||
*/
|
||||
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$
|
||||
return isExecutable(receiver);
|
||||
}
|
||||
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,
|
||||
|
|
Loading…
Add table
Reference in a new issue