org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput Java Examples
The following examples show how to use
org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XbaseDocumentProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected ElementInfo createElementInfo(Object element) throws CoreException { if (element instanceof IClassFileEditorInput) { IDocument document = null; IStatus status = null; try { document = createDocument(element); } catch (CoreException x) { status = x.getStatus(); document = createEmptyDocument(); } ClassFileInfo info = new ClassFileInfo(document, createAnnotationModel(element)); info.fStatus = status; registerAnnotationInfoProcessor(info); return info; } return super.createElementInfo(element); }
Example #2
Source File: JavaSourceViewerConfiguration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private IJavaProject getProject() { ITextEditor editor= getEditor(); if (editor == null) return null; IJavaElement element= null; IEditorInput input= editor.getEditorInput(); IDocumentProvider provider= editor.getDocumentProvider(); if (provider instanceof ICompilationUnitDocumentProvider) { ICompilationUnitDocumentProvider cudp= (ICompilationUnitDocumentProvider) provider; element= cudp.getWorkingCopy(input); } else if (input instanceof IClassFileEditorInput) { IClassFileEditorInput cfei= (IClassFileEditorInput) input; element= cfei.getClassFile(); } if (element == null) return null; return element.getJavaProject(); }
Example #3
Source File: OccurrencesSearchResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { //TODO same code in 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; IClassFile classFile= classFileEditorInput.getClassFile(); Object[] elements= getElements(); if (elements.length == 0) return NO_MATCHES; //all matches from same file: JavaElementLine jel= (JavaElementLine) elements[0]; if (jel.getJavaElement().equals(classFile)) return collectMatches(elements); } return NO_MATCHES; }
Example #4
Source File: OccurrencesSearchResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public boolean isShownInEditor(Match match, IEditorPart editor) { Object element= match.getElement(); IJavaElement je= ((JavaElementLine) element).getJavaElement(); IEditorInput editorInput= editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { try { return ((IFileEditorInput)editorInput).getFile().equals(je.getCorrespondingResource()); } catch (JavaModelException e) { return false; } } else if (editorInput instanceof IClassFileEditorInput) { return ((IClassFileEditorInput)editorInput).getClassFile().equals(je); } return false; }
Example #5
Source File: XbaseResourceForEditorInputFactory.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public Resource createResource(IEditorInput editorInput) { if (editorInput instanceof IClassFileEditorInput) { Resource resource = createResource(((IClassFileEditorInput) editorInput).getClassFile()); if (resource != null) return resource; } return super.createResource(editorInput); }
Example #6
Source File: NLSSearchResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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<Match>(); collectMatches(matches, classFileEditorInput.getClassFile()); return matches.toArray(new Match[matches.size()]); } return NO_MATCHES; }
Example #7
Source File: TextSelectionConverter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static IJavaElement getInput(JavaEditor editor) { if (editor == null) return null; IEditorInput input= editor.getEditorInput(); if (input instanceof IClassFileEditorInput) return ((IClassFileEditorInput)input).getClassFile(); IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); return manager.getWorkingCopy(input); }
Example #8
Source File: JavaElementAdapterFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; }
Example #9
Source File: JavaSearchPageScoreComputer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public int computeScore(String id, Object element) { if (!JavaSearchPage.EXTENSION_POINT_ID.equals(id)) // Can't decide return ISearchPageScoreComputer.UNKNOWN; if (element instanceof IJavaElement || element instanceof IClassFileEditorInput || element instanceof LogicalPackage || (element instanceof IEditorInput && JavaUI.getEditorInputJavaElement((IEditorInput)element) != null)) return 90; return ISearchPageScoreComputer.LOWEST; }
Example #10
Source File: JavaWorkbenchAdapter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; }
Example #11
Source File: GoToNextPreviousMemberAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IType[] getTypes() throws JavaModelException { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { return new IType[] { ((IClassFileEditorInput)input).getClassFile().getType() }; } else { return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input).getAllTypes(); } }
Example #12
Source File: GoToNextPreviousMemberAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private ISourceReference getSourceReference() { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { return ((IClassFileEditorInput)input).getClassFile(); } else { return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input); } }
Example #13
Source File: AbstractJavaEditorTextHover.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected ICodeAssist getCodeAssist() { if (fEditor != null) { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { IClassFileEditorInput cfeInput= (IClassFileEditorInput) input; return cfeInput.getClassFile(); } WorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); return manager.getWorkingCopy(input, false); } return null; }