/** * Determine if we're in smart insert mode (if so, don't do any edit magic) * * @return true if the editor is in smart mode (or if it's an unknown editor type) */ private static boolean isSmartInsertMode() { ITextEditor textEditor = AdtUtils.getActiveTextEditor(); if (textEditor instanceof ITextEditorExtension3) { ITextEditorExtension3 editor = (ITextEditorExtension3) textEditor; return editor.getInsertMode() == ITextEditorExtension3.SMART_INSERT; } return true; }
private boolean isSmartMode() { IWorkbenchPage page = AtlUIPlugin.getActivePage(); if (page != null) { IEditorPart part = page.getActiveEditor(); if (part instanceof ITextEditorExtension3) { ITextEditorExtension3 extension = (ITextEditorExtension3) part; return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; } } return false; }
/** * Returns whether the Smart Insert Mode is selected. * * @return <code>true</code> if the Smart Insert Mode is selected * @since 3.7 */ private boolean isSmartInsertMode() { IWorkbenchPage page = JavaPlugin.getActivePage(); if (page != null) { IEditorPart part = page.getActiveEditor(); if (part instanceof ITextEditorExtension3) { ITextEditorExtension3 extension = (ITextEditorExtension3) part; return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; } else if (part != null && EditorUtility.isCompareEditorInput(part.getEditorInput())) { ITextEditorExtension3 extension = (ITextEditorExtension3) part.getAdapter(ITextEditorExtension3.class); if (extension != null) return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT; } } return false; }