private ICompilationUnit getCompilationUnit() { IJavaElement elem= JavaUI.getEditorInputJavaElement(fEditor.getEditorInput()); if (elem instanceof ICompilationUnit) { return (ICompilationUnit) elem; } return null; }
private ICompilationUnit getCompilationUnit() { IJavaElement elem= JavaUI.getEditorInputJavaElement(fEditor.getEditorInput()); if (elem instanceof ICompilationUnit) { return (ICompilationUnit) elem; } return null; }
private IResource getResource() { IEditorInput input= fTextEditor.getEditorInput(); if (input instanceof IFileEditorInput) { IFileEditorInput fileInput= (IFileEditorInput) input; return fileInput.getFile(); } return null; }
private IProblemRequestorExtension getProblemRequestorExtension() { IAnnotationModel model= fDocumentProvider.getAnnotationModel(fEditor.getEditorInput()); if (model instanceof IProblemRequestorExtension) return (IProblemRequestorExtension) model; return null; }
public String getCurrentEditorContent() { final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (!(editor instanceof ITextEditor)) return null; ITextEditor ite = (ITextEditor)editor; IDocument doc = ite.getDocumentProvider().getDocument(ite.getEditorInput()); return doc.get(); }
/** * Creates a new savable for this text editor. * * @param textEditor the text editor */ public TextEditorSavable(ITextEditor textEditor) { Assert.isLegal(textEditor != null); fTextEditor= textEditor; fEditorInput= fTextEditor.getEditorInput(); Assert.isLegal(fEditorInput != null); }
/** * Returns the text editor's document. * * @param part the text editor * @return the document of the given text editor */ private IDocument getDocument(ITextEditor part) { IDocumentProvider provider= part.getDocumentProvider(); return provider.getDocument(part.getEditorInput()); }
/** * Gets the resource which is being edited in the editor. * * @return the resource being edited or <code>null</code>s */ private IResource getResource() { if (getTextEditor() != null && getTextEditor().getEditorInput() != null) return getTextEditor().getEditorInput().getAdapter(IResource.class); return null; }
/** * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input. * * @return the marker annotation model */ protected AbstractMarkerAnnotationModel getAnnotationModel() { IDocumentProvider provider= fTextEditor.getDocumentProvider(); IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput()); if (model instanceof AbstractMarkerAnnotationModel) return (AbstractMarkerAnnotationModel) model; return null; }
/** * Returns the <code>IDocument</code> of the editor's input. * * @return the document of the editor's input */ protected IDocument getDocument() { IDocumentProvider provider= fTextEditor.getDocumentProvider(); return provider.getDocument(fTextEditor.getEditorInput()); }
private static void ensureUpdatedAnnotations(ITextEditor editor) { Object inputElement= editor.getEditorInput().getAdapter(IJavaElement.class); if (inputElement instanceof ICompilationUnit) { SharedASTProviderCore.getAST((ICompilationUnit) inputElement, SharedASTProviderCore.WAIT_ACTIVE_ONLY, null); } }
@Override protected IAnnotationModel getAnnotationModel() { final IDocumentProvider documentProvider= fEditor.getDocumentProvider(); if (documentProvider == null) return null; return documentProvider.getAnnotationModel(fEditor.getEditorInput()); } }
/** * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input. * * @return the marker annotation model */ protected AbstractMarkerAnnotationModel getAnnotationModel() { IDocumentProvider provider= fTextEditor.getDocumentProvider(); IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput()); if (model instanceof AbstractMarkerAnnotationModel) return (AbstractMarkerAnnotationModel) model; return null; }
private static IRegion getRegionOfInterest(ITextEditor editor, int invocationLocation) throws BadLocationException { IDocumentProvider documentProvider= editor.getDocumentProvider(); if (documentProvider == null) { return null; } IDocument document= documentProvider.getDocument(editor.getEditorInput()); if (document == null) { return null; } return document.getLineInformationOfOffset(invocationLocation); }
/** * Inserts the given template into the editor. * * @param template the template */ private void insertTemplate(Template template) { IDocument document= fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput()); insertTemplate(template, document); }
public IAnnotationModel getAnnotationModel(Match match) { IAnnotationModel annoModel = null; ITextEditor textEditor = getTextEditor(); if (textEditor != null) { annoModel = textEditor.getDocumentProvider().getAnnotationModel(textEditor.getEditorInput()); } return annoModel; } };
private static IRegion getRegionOfInterest(ITextEditor editor, int invocationLocation) throws BadLocationException { IDocumentProvider documentProvider= editor.getDocumentProvider(); if (documentProvider == null) { return null; } IDocument document= documentProvider.getDocument(editor.getEditorInput()); if (document == null) { return null; } return document.getLineInformationOfOffset(invocationLocation); }
/** * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input. * * @return the marker annotation model or <code>null</code> if there's none */ protected IAnnotationModel getAnnotationModel() { IDocumentProvider provider= getTextEditor().getDocumentProvider(); return provider.getAnnotationModel(getTextEditor().getEditorInput()); }
/** * Returns the context type ids supported at the current * caret position of the editor. * * @return an array with the the supported context type ids */ private String[] getEditorContextTypeIds() { Point selectedRange=fViewer.getSelectedRange(); int offset= selectedRange.x + selectedRange.y; IDocument document= fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput()); return getContextTypeIds(document, offset); }
private boolean computeEnablement(ITextEditor editor) { if (editor == null) return false; ITextOperationTarget target= editor.getAdapter(ITextOperationTarget.class); if (target == null || ! target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) return false; IJavaProject javaProject = EditorUtility.getJavaProject(editor.getEditorInput()); if (! fCategory.matches(javaProject)) return false; ISelection selection= editor.getSelectionProvider().getSelection(); return isValidSelection(selection); }