Community
Participate
Working Groups
Currently to get IFile for selected resource requires adding adapter that makes extensions dependent on JDT. While actually it is missing functionality in JDT (as well as in JSDT). Please provide such adapter with JDT. import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IAdapterFactory; import org.eclipse.jdt.core.ICompilationUnit; /** The adapter factory class http://stackoverflow.com/questions/775709/eclipse-pde-navigator-view-treeselection-obtaining-the-file-type-and-name */ public class CompilationUnitToFileAdapter implements IAdapterFactory { @Override public Object getAdapter(Object adaptableObject, Class adapterType) { if (adaptableObject instanceof ICompilationUnit) // note: "adapting" it here just means returning the ref'd IFile return (IFile) ((ICompilationUnit)adaptableObject).getResource(); return null; } @Override public Class[] getAdapterList() { return new Class[] {IFile.class}; } } plugin.xml <!-- --> <extension point="org.eclipse.core.runtime.adapters"> <factory adaptableType="org.eclipse.jdt.core.ICompilationUnit" class="org.nodeclipse.enide.jdt.CompilationUnitToFileAdapter"> <adapter type="org.eclipse.core.resources.IFile" /> </factory> </extension>