1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

2004-11-11 Alain Magloire

Fix for PR 78441
	* src/org/eclipse/cdt/launch/internal/CPropertyTester.java
	* plugin.xml
This commit is contained in:
Alain Magloire 2004-11-11 21:38:06 +00:00
parent 66b367c79f
commit af6a913751
3 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2004-11-11 Alain Magloire
Fix for PR 78441
* src/org/eclipse/cdt/launch/internal/CPropertyTester.java
* plugin.xml
2004-11-1 David Inglis
Use status handlers to prompt for launch input (process id and core file).

View file

@ -126,7 +126,7 @@
<propertyTester
namespace="org.eclipse.cdt.launch"
properties="isExecutable"
type="org.eclipse.core.resources.IResource"
type="org.eclipse.core.runtime.IAdaptable"
class="org.eclipse.cdt.launch.internal.CPropertyTester"
id="org.eclipse.cdt.launch.CPropertyTester">
</propertyTester>
@ -146,4 +146,19 @@
id="org.eclipse.cdt.launch.statusHandler.coreFilePrompter">
</statusHandler>
</extension>
<!-- Adapters for contextual launch -->
<extension point="org.eclipse.core.runtime.adapters">
<factory
class=""
adaptableType="org.eclipse.cdt.core.model.IBinary">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
<factory
class=""
adaptableType="org.eclipse.core.resources.IResource">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
</extension>
</plugin>

View file

@ -15,6 +15,8 @@ import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
/**
* A property tester that determines if a file is an executable.
@ -36,10 +38,11 @@ public class CPropertyTester extends PropertyTester {
* @return true if the target resource has a <code>main</code> method,
* <code>false</code> otherwise.
*/
private boolean isExecutable(Object target) {
private boolean isExecutable(Object receiver) {
ICElement celement = null;
if (target instanceof IFile) {
celement = CoreModel.getDefault().create((IFile) target);
IFile file = (IFile) ((IAdaptable)receiver).getAdapter(IResource.class);
if (file != null) {
celement = CoreModel.getDefault().create(file);
}
return (celement != null && celement instanceof IBinary);
}