/** * Checks and validates the editor's modifiable state. Returns <code>true</code> if an action * can proceed modifying the editor's input, <code>false</code> if it should not. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#validateEditorInputState()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #canModifyEditor()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action can proceed to modify the underlying document, <code>false</code> otherwise * @since 3.0 */ protected boolean validateEditorInputState() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).validateEditorInputState(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; } }
/** * Checks the editor's modifiable state. Returns <code>true</code> if the editor can be modified, * taking in account the possible editor extensions. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#isEditorInputModifiable()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #validateEditorInputState()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action should be enabled, <code>false</code> otherwise * @since 3.0 */ protected boolean canModifyEditor() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).isEditorInputModifiable(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; }
/** * Checks and validates the editor's modifiable state. Returns <code>true</code> if an action * can proceed modifying the editor's input, <code>false</code> if it should not. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#validateEditorInputState()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #canModifyEditor()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action can proceed to modify the underlying document, <code>false</code> otherwise * @since 3.0 */ protected boolean validateEditorInputState() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).validateEditorInputState(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; } }
/** * Checks and validates the editor's modifiable state. Returns <code>true</code> if an action * can proceed modifying the editor's input, <code>false</code> if it should not. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#validateEditorInputState()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #canModifyEditor()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action can proceed to modify the underlying document, <code>false</code> otherwise * @since 3.0 */ protected boolean validateEditorInputState() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).validateEditorInputState(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; } }
/** * Checks the editor's modifiable state. Returns <code>true</code> if the editor can be modified, * taking in account the possible editor extensions. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#isEditorInputModifiable()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #validateEditorInputState()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action should be enabled, <code>false</code> otherwise * @since 3.0 */ protected boolean canModifyEditor() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).isEditorInputModifiable(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; }
/** * Checks the editor's modifiable state. Returns <code>true</code> if the editor can be modified, * taking in account the possible editor extensions. * * <p>If the editor implements <code>ITextEditorExtension2</code>, * this method returns {@link ITextEditorExtension2#isEditorInputModifiable()};<br> else if the editor * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br> * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p> * * <p>There is only a difference to {@link #validateEditorInputState()} if the editor implements * <code>ITextEditorExtension2</code>.</p> * * @return <code>true</code> if a modifying action should be enabled, <code>false</code> otherwise * @since 3.0 */ protected boolean canModifyEditor() { ITextEditor editor= getTextEditor(); if (editor instanceof ITextEditorExtension2) return ((ITextEditorExtension2) editor).isEditorInputModifiable(); else if (editor instanceof ITextEditorExtension) return !((ITextEditorExtension) editor).isEditorInputReadOnly(); else if (editor != null) return editor.isEditable(); else return false; }
@Override protected ITextEditor run() throws Exception { IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); IEditorPart editor = activePage.findEditor(fileEditorInput); if (editor instanceof ITextEditor) { if (editor instanceof ITextEditorExtension && ((ITextEditorExtension) editor).isEditorInputReadOnly()) status.add(ERROR, "Editor for {0} is read only", fileEditorInput.getName()); return ((ITextEditor) editor); } return null; } }.syncExec();
continue; boolean isReadOnly = fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly(); if (!isReadOnly) { fPosition = position;
/** * Returns whether quick diff info should be visible upon opening an editor * according to the preference store settings. * * @return <code>true</code> if the line numbers should be visible */ private boolean getQuickDiffPreference() { if (fForwarder != null) return fForwarder.isQuickDiffEnabled(); IPreferenceStore store= getPreferenceStore(); boolean setting= store != null ? store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON) : false; if (!setting) return false; boolean modifiable; ITextEditor editor= getEditor(); if (editor instanceof ITextEditorExtension2) { ITextEditorExtension2 ext= (ITextEditorExtension2) editor; modifiable= ext.isEditorInputModifiable(); } else if (editor instanceof ITextEditorExtension) { ITextEditorExtension ext= (ITextEditorExtension) editor; modifiable= ext.isEditorInputReadOnly(); } else if (editor != null) { modifiable= editor.isEditable(); } else { modifiable= true; } return modifiable; }
/** * Returns whether quick diff info should be visible upon opening an editor * according to the preference store settings. * * @return <code>true</code> if the line numbers should be visible */ private boolean getQuickDiffPreference() { if (fForwarder != null) return fForwarder.isQuickDiffEnabled(); IPreferenceStore store= getPreferenceStore(); boolean setting= store != null ? store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON) : false; if (!setting) return false; boolean modifiable; ITextEditor editor= getEditor(); if (editor instanceof ITextEditorExtension2) { ITextEditorExtension2 ext= (ITextEditorExtension2) editor; modifiable= ext.isEditorInputModifiable(); } else if (editor instanceof ITextEditorExtension) { ITextEditorExtension ext= (ITextEditorExtension) editor; modifiable= ext.isEditorInputReadOnly(); } else if (editor != null) { modifiable= editor.isEditable(); } else { modifiable= true; } return modifiable; }
&& ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly(); if (!isReadOnly && ((RutaCorrectionProcessor.hasCorrections(annotation)))) { fPosition = position;
continue; boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly(); if (!isReadOnly && (
continue; boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly(); if (!isReadOnly && (
continue; boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly(); if (!isReadOnly && (