try { element= javaElement.getUnderlyingResource(); } catch (JavaModelException e) {
IFile matchFile= null; ICompilationUnit cu= (ICompilationUnit) javaElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { matchFile= (IFile) cu.getResource(); } else { IClassFile cf= (IClassFile) javaElement.getAncestor(IJavaElement.CLASS_FILE); if (cf != null) matchFile= (IFile) cf.getResource();
	public IFile getFile(Object element) {		if (element instanceof IJavaElement) {			IJavaElement javaElement= (IJavaElement) element;			try {				element= javaElement.getUnderlyingResource();			} catch (JavaModelException e) {				// we can't get a resource for this.			}		}		if (element instanceof IFile)			return (IFile)element;		return null;	}