/** * Displays information in the status line why a line move is not possible */ private void showStatus() { ITextEditor editor= getTextEditor(); if (editor == null) return; IEditorStatusLine status= editor.getAdapter(IEditorStatusLine.class); if (status == null) return; status.setMessage(false, EditorMessages.Editor_MoveLines_IllegalMove_status, null); }
/** * 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()); }
@Override public void update() { super.update(); if (!isEnabled()) return; if (!canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); setEnabled(editor.isEditable()); }
/** * 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()); }
@Override protected IAnnotationModel getAnnotationModel() { final IDocumentProvider documentProvider= fEditor.getDocumentProvider(); if (documentProvider == null) return null; return documentProvider.getAnnotationModel(fEditor.getEditorInput()); } }
private IProblemRequestorExtension getProblemRequestorExtension() { IAnnotationModel model= fDocumentProvider.getAnnotationModel(fEditor.getEditorInput()); if (model instanceof IProblemRequestorExtension) return (IProblemRequestorExtension) model; return null; }
@Override public void update() { super.update(); if (isEnabled()) setEnabled(canModifyEditor()); }
/** * Gets the editor's encoding support. * * @return the resource being edited or <code>null</code>s */ private IEncodingSupport getEncodingSupport() { if (getTextEditor() != null) return (IEncodingSupport)getTextEditor().getAdapter(IEncodingSupport.class); return null; } }
@Override public void update() { super.update(); setEnabled(canModifyEditor()); }
/** * Sets the given message as error message to this editor's status line. * * @param message message to be set * @since 3.2 */ protected void setStatusLineErrorMessage(String message) { IEditorStatusLine statusLine= (IEditorStatusLine)getAdapter(IEditorStatusLine.class); if (statusLine != null) statusLine.setMessage(true, message, null); }
@Override public void update() { setEnabled(getTextEditor().isDirty()); } }
/** * Returns the annotation preference for the given annotation. * * @param annotation the annotation * @return the annotation preference for the given annotation or <code>null</code> */ private AnnotationPreference getAnnotationPreference(Annotation annotation) { AnnotationPreferenceLookup lookup= getAnnotationPreferenceLookup(); if (lookup != null) return lookup.getAnnotationPreference(annotation); return null; }
@Override public void run() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension5) { ITextEditorExtension5 ext5= (ITextEditorExtension5) editor; ext5.setBlockSelectionMode(!ext5.isBlockSelectionModeEnabled()); } update(); // update in case anyone else has directly accessed the widget }
/** * Get the <code>ITextViewer</code> from an <code>ITextEditor</code>. * * @return the text viewer or <code>null</code> */ private ITextViewer getTextViewer() { ITextEditor editor= getTextEditor(); if (editor instanceof AbstractTextEditor) return ((AbstractTextEditor)editor).getSourceViewer(); return null; }
@Override protected void handleEditorInputChanged() { super.handleEditorInputChanged(); updatePartControl(); }
@Override public boolean validateEditorInputState() { if (!super.validateEditorInputState()) return false; return validateEditorInputDerived(); }
@Override protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { return new MarkerRulerAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ManageBookmarks.", editor, rulerInfo, IMarker.BOOKMARK, true); //$NON-NLS-1$ } }
/** * 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; }
/** * Get the <code>ITextViewer</code> from an <code>ITextEditor</code>. * * @return the text viewer or <code>null</code> */ private ITextViewer getTextViewer() { ITextEditor editor= getTextEditor(); if (editor instanceof AbstractTextEditor) return ((AbstractTextEditor)editor).getSourceViewer(); return null; }