Bug 58815 "Show source of selected elements only" for the Ant Editor
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/EditorUtility.java
editorDescriptor= registry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
		
		
		if (editorDescriptor == null && registry.isSystemExternalEditorAvailable(inputName))
			editorDescriptor= registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
		
		
		if (editorDescriptor == null)
			editorDescriptor= registry.findEditor("org.eclipse.ui.DefaultTextEditor"); 
		
		
		if (editorDescriptor == null)
			return null;
		
		return editorDescriptor.getId();
	}
	
	private static IEditorInput getEditorInput(IJavaElement element) throws JavaModelException {
		while (element != null) {			
			if (element instanceof ICompilationUnit) {
				ICompilationUnit unit= JavaModelUtil.toOriginal((ICompilationUnit) element);
					IResource resource= unit.getResource();
					if (resource instanceof IFile)
						return new FileEditorInput((IFile) resource);
			}
			
			if (element instanceof IClassFile)
				return new InternalClassFileEditorInput((IClassFile) element);
			
			element= element.getParent();