1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +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 2004-11-1 David Inglis
Use status handlers to prompt for launch input (process id and core file). Use status handlers to prompt for launch input (process id and core file).

View file

@ -126,7 +126,7 @@
<propertyTester <propertyTester
namespace="org.eclipse.cdt.launch" namespace="org.eclipse.cdt.launch"
properties="isExecutable" properties="isExecutable"
type="org.eclipse.core.resources.IResource" 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">
</propertyTester> </propertyTester>
@ -146,4 +146,19 @@
id="org.eclipse.cdt.launch.statusHandler.coreFilePrompter"> id="org.eclipse.cdt.launch.statusHandler.coreFilePrompter">
</statusHandler> </statusHandler>
</extension> </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> </plugin>

View file

@ -15,6 +15,8 @@ import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile; 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. * 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, * @return true if the target resource has a <code>main</code> method,
* <code>false</code> otherwise. * <code>false</code> otherwise.
*/ */
private boolean isExecutable(Object target) { private boolean isExecutable(Object receiver) {
ICElement celement = null; ICElement celement = null;
if (target instanceof IFile) { IFile file = (IFile) ((IAdaptable)receiver).getAdapter(IResource.class);
celement = CoreModel.getDefault().create((IFile) target); if (file != null) {
celement = CoreModel.getDefault().create(file);
} }
return (celement != null && celement instanceof IBinary); return (celement != null && celement instanceof IBinary);
} }