private JavaModelException probeInputForSource(IEditorInput input) { if (input == null) return null; IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IClassFile file= classFileEditorInput.getClassFile(); try { file.getSourceRange(); } catch (JavaModelException e) { return e; } return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; } }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; } }
private JavaModelException probeInputForSource(IEditorInput input) { if (input == null) return null; IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IClassFile file= classFileEditorInput.getClassFile(); try { file.getSourceRange(); } catch (JavaModelException e) { return e; } return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; } }
private JavaModelException probeInputForSource(IEditorInput input) { if (input == null) return null; IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IClassFile file= classFileEditorInput.getClassFile(); try { file.getSourceRange(); } catch (JavaModelException e) { return e; } return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; }
/** * Default constructor. */ public ClassFileSynchronizer(IClassFileEditorInput input) { fInput= input; IJavaElement parent= fInput.getClassFile().getParent(); while (parent != null && !(parent instanceof IPackageFragmentRoot)) { parent= parent.getParent(); } fPackageFragmentRoot= (IPackageFragmentRoot) parent; }
/** * Default constructor. * * @param input the class file editor input */ public ClassFileSynchronizer(IClassFileEditorInput input) { fInput= input; IJavaElement parent= fInput.getClassFile().getParent(); while (parent != null && !(parent instanceof IPackageFragmentRoot)) { parent= parent.getParent(); } fPackageFragmentRoot= (IPackageFragmentRoot) parent; }
/** * Default constructor. * * @param input the class file editor input */ public ClassFileSynchronizer(IClassFileEditorInput input) { fInput= input; IJavaElement parent= fInput.getClassFile().getParent(); while (parent != null && !(parent instanceof IPackageFragmentRoot)) { parent= parent.getParent(); } fPackageFragmentRoot= (IPackageFragmentRoot) parent; }
/** * Translates the given editor input into an <code>ExternalClassFileEditorInput</code> * if it is a file editor input representing an external class file. * * @param input the editor input to be transformed if necessary * @return the transformed editor input */ protected IEditorInput transformEditorInput(IEditorInput input) { if (input instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) input).getFile(); IClassFileEditorInput classFileInput= new ExternalClassFileEditorInput(file); if (classFileInput.getClassFile() != null) input= classFileInput; } return input; }
@Override protected IJavaElement getCorrespondingElement(IJavaElement element) { if (getEditorInput() instanceof IClassFileEditorInput) { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE); if (input.getClassFile().equals(parent)) return element; } return null; }
@Override protected IJavaElement getCorrespondingElement(IJavaElement element) { if (getEditorInput() instanceof IClassFileEditorInput) { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE); if (input.getClassFile().equals(parent)) return element; } return null; }
protected IJavaElement getCorrespondingElement(IJavaElement element) { if (getEditorInput() instanceof IClassFileEditorInput) { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE); if (input.getClassFile().equals(parent)) return element; } return null; }
@Override public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { //TODO: copied from JavaSearchResult: IEditorInput editorInput= editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput; return computeContainedMatches(result, fileEditorInput.getFile()); } else if (editorInput instanceof IClassFileEditorInput) { IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput; Set<Match> matches= new HashSet<>(); collectMatches(matches, classFileEditorInput.getClassFile()); return matches.toArray(new Match[matches.size()]); } return NO_MATCHES; }
/** * Translates the given editor input into an <code>ExternalClassFileEditorInput</code> * if it is a file editor input representing an external class file. * * @param input the editor input to be transformed if necessary * @return the transformed editor input */ protected IEditorInput transformEditorInput(IEditorInput input) { if (input instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) input).getFile(); IClassFileEditorInput classFileInput= new ExternalClassFileEditorInput(file); if (classFileInput.getClassFile() != null) input= classFileInput; } return input; }
/** * Translates the given editor input into an <code>ExternalClassFileEditorInput</code> * if it is a file editor input representing an external class file. * * @param input the editor input to be transformed if necessary * @return the transformed editor input */ protected IEditorInput transformEditorInput(IEditorInput input) { if (input instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) input).getFile(); IClassFileEditorInput classFileInput= new ExternalClassFileEditorInput(file); if (classFileInput.getClassFile() != null) input= classFileInput; } return input; }
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { //TODO: copied from JavaSearchResult: IEditorInput editorInput= editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput; return computeContainedMatches(result, fileEditorInput.getFile()); } else if (editorInput instanceof IClassFileEditorInput) { IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput; Set matches= new HashSet(); collectMatches(matches, classFileEditorInput.getClassFile()); return (Match[]) matches.toArray(new Match[matches.size()]); } return NO_MATCHES; }