Java 类org.eclipse.ui.texteditor.TextEditorAction 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:EditorUtility.java   
private static void initializeHighlightRange(IEditorPart editorPart) {
    if (editorPart instanceof ITextEditor) {
        IAction toggleAction= editorPart.getEditorSite().getActionBars().getGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);
        boolean enable= toggleAction != null;
        if (enable && editorPart instanceof JavaEditor)
            enable= JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS);
        else
            enable= enable && toggleAction.isEnabled() && toggleAction.isChecked();
        if (enable) {
            if (toggleAction instanceof TextEditorAction) {
                // Reset the action
                ((TextEditorAction)toggleAction).setEditor(null);
                // Restore the action
                ((TextEditorAction)toggleAction).setEditor((ITextEditor)editorPart);
            } else {
                // Uncheck
                toggleAction.run();
                // Check
                toggleAction.run();
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditorUtility.java   
private static void initializeHighlightRange(IEditorPart editorPart) {
    if (editorPart instanceof ITextEditor) {
        IAction toggleAction= editorPart.getEditorSite().getActionBars().getGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);
        boolean enable= toggleAction != null;
        if (enable && editorPart instanceof JavaEditor)
            enable= JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS);
        else
            enable= enable && toggleAction.isEnabled() && toggleAction.isChecked();
        if (enable) {
            if (toggleAction instanceof TextEditorAction) {
                // Reset the action
                ((TextEditorAction)toggleAction).setEditor(null);
                // Restore the action
                ((TextEditorAction)toggleAction).setEditor((ITextEditor)editorPart);
            } else {
                // Uncheck
                toggleAction.run();
                // Check
                toggleAction.run();
            }
        }
    }
}
项目:syncope    文件:HTMLEditor.java   
@Override
protected void createActions() {
    super.createActions();
    IAction a = (TextEditorAction) new AutoIndentAction(
            ResourceBundle.getBundle(RESOURCE_BUNDLE), "AutoIndent", null);
    setAction("AutoIndent", a);
}