Search in sources :

Example 1 with PyMoveLineUpAction

use of org.python.pydev.editor.actions.PyMoveLineUpAction in project Pydev by fabioz.

the class PyEdit method createActions.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
     *
     * TODO: Fix content assist to work in emacs mode:
     * http://wiki.eclipse.org/index.php/FAQ_How_do_I_add_Content_Assist_to_my_editor%3F
     * http://www.eclipse.org/newsportal/article.php?id=61744&group=eclipse.platform#61744
     */
@Override
protected void createActions() {
    super.createActions();
    try {
        MyResources resources = new MyResources();
        IAction action;
        // Quick-Assist: it's added to the platform as of Eclipse 3.2, so, we do not have to put the binding here
        // -------------------------------------------------------------------------------------
        // This action will fire a CONTENTASSIST_PROPOSALS operation
        // when executed
        action = new ContentAssistAction(resources, "ContentAssistProposal.", this);
        action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
        setAction("ContentAssistProposal", action);
        markAsStateDependentAction("ContentAssistProposal", true);
        // -------------------------------------------------------------------------------------
        // open action
        IAction openAction = new PyOpenAction();
        setAction(ACTION_OPEN, openAction);
        // -------------------------------------------------------------------------------------
        // Offline action
        action = new OfflineAction(resources, "Pyedit.ScriptEngine.", this);
        action.setActionDefinitionId("org.python.pydev.editor.actions.scriptEngine");
        action.setId("org.python.pydev.editor.actions.scriptEngine");
        setAction("PyDevScriptEngine", action);
        // move lines
        if (this.getIndentPrefs().getSmartLineMove()) {
            // Don't even bind the action if the smart line move is not set.
            // This means 2 things:
            // - Uses the default action when asked
            // - An editor restart will be needed to have it applied
            action = new PyMoveLineUpAction(resources, "Pyedit.MoveLinesUp.", this);
            action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_UP);
            action.setId("org.python.pydev.editor.actions.moveLineUp");
            setAction(ITextEditorActionConstants.MOVE_LINE_UP, action);
            action = new PyMoveLineDownAction(resources, "Pyedit.MoveLinesDown.", this);
            action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_DOWN);
            action.setId("org.python.pydev.editor.actions.moveLineDown");
            setAction(ITextEditorActionConstants.MOVE_LINE_DOWN, action);
        }
        notifier.notifyOnCreateActions(resources);
        onCreateActions.call(this);
    } catch (Throwable e) {
        Log.log(e);
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) PyMoveLineUpAction(org.python.pydev.editor.actions.PyMoveLineUpAction) PyOpenAction(org.python.pydev.editor.actions.PyOpenAction) OfflineAction(org.python.pydev.editor.actions.OfflineAction) PyMoveLineDownAction(org.python.pydev.editor.actions.PyMoveLineDownAction) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction)

Aggregations

IAction (org.eclipse.jface.action.IAction)1 ContentAssistAction (org.eclipse.ui.texteditor.ContentAssistAction)1 OfflineAction (org.python.pydev.editor.actions.OfflineAction)1 PyMoveLineDownAction (org.python.pydev.editor.actions.PyMoveLineDownAction)1 PyMoveLineUpAction (org.python.pydev.editor.actions.PyMoveLineUpAction)1 PyOpenAction (org.python.pydev.editor.actions.PyOpenAction)1