Example usage for java.awt.event InputEvent CTRL_DOWN_MASK

List of usage examples for java.awt.event InputEvent CTRL_DOWN_MASK

Introduction

In this page you can find the example usage for java.awt.event InputEvent CTRL_DOWN_MASK.

Prototype

int CTRL_DOWN_MASK

To view the source code for java.awt.event InputEvent CTRL_DOWN_MASK.

Click Source Link

Document

The Control key extended modifier constant.

Usage

From source file:org.eclipse.jubula.client.ui.rcp.constants.InputCodeHelper.java

/**
 * private constructor/*from  w w  w. j av  a 2  s. co  m*/
 *
 */
private InputCodeHelper() {

    m_modifier[0] = InputEvent.CTRL_DOWN_MASK;
    m_modifier[1] = InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
    m_modifier[2] = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;
    m_modifier[3] = InputEvent.ALT_DOWN_MASK;
    m_modifier[4] = InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
    m_modifier[5] = 0; // no modifier pressed

    List<UserInput> inputList = new ArrayList<UserInput>();
    List<String> inputStringList = new ArrayList<String>();
    for (int i = KeyEvent.VK_0; i <= KeyEvent.VK_9; i++) {
        inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS));
        inputStringList.add(KeyEvent.getKeyText(i));
    }
    for (int i = KeyEvent.VK_A; i <= KeyEvent.VK_Z; i++) {
        inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS));
        inputStringList.add(KeyEvent.getKeyText(i));
    }
    for (int i = KeyEvent.VK_NUMPAD0; i <= KeyEvent.VK_ADD; i++) {
        inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS));
        inputStringList.add(KeyEvent.getKeyText(i));
    }
    for (int i = KeyEvent.VK_SUBTRACT; i <= KeyEvent.VK_DIVIDE; i++) {
        inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS));
        inputStringList.add(KeyEvent.getKeyText(i));
    }
    for (int i = KeyEvent.VK_F1; i <= KeyEvent.VK_F12; i++) {
        inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS));
        inputStringList.add(KeyEvent.getKeyText(i));
    }

    m_modifierString = new String[m_modifier.length];
    for (int i = 0; i < m_modifier.length; i++) {
        m_modifierString[i] = InputEvent.getModifiersExText(m_modifier[i]);
    }

    m_keys = inputList.toArray(new UserInput[inputList.size()]);
    m_keyStrings = inputStringList.toArray(new String[inputStringList.size()]);

    inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_LEFT, InputConstants.TYPE_MOUSE_CLICK));
    inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_MIDDLE, InputConstants.TYPE_MOUSE_CLICK));
    inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_RIGHT, InputConstants.TYPE_MOUSE_CLICK));

    inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton1);
    inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton2);
    inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton3);

    m_inputs = inputList.toArray(new UserInput[inputList.size()]);
    m_inputStrings = inputStringList.toArray(new String[inputStringList.size()]);
}

From source file:org.omegat.gui.scripting.ScriptingWindow.java

private void addRunShortcutToOmegaT() {
    JRootPane appliRootPane = Core.getMainWindow().getApplicationFrame().getRootPane();
    appliRootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK, false),
            "RUN_CURRENT_SCRIPT");
    appliRootPane.getActionMap().put("RUN_CURRENT_SCRIPT", new AbstractAction() {
        private static final long serialVersionUID = 1L;

        @Override/*from  w w  w  . j  av a 2 s  .  c o  m*/
        public void actionPerformed(ActionEvent e) {
            runScript();
        }
    });
}

From source file:org.orbisgis.groovy.GroovyConsolePanel.java

/**
 * Create actions instances//from   ww w.j  a va 2  s.c  o  m
 *
 * Each action is put in the Popup menu and the tool bar Their shortcuts are
 * registered also in the editor
 */
private void initActions() {
    //Execute action
    executeAction = new DefaultAction(GroovyConsoleActions.A_EXECUTE, I18N.tr("Execute"),
            I18N.tr("Execute the groovy script"), GroovyIcon.getIcon("execute"),
            EventHandler.create(ActionListener.class, this, "onExecute"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom");
    actions.addAction(executeAction);

    //Execute Selected SQL
    executeSelectedAction = new DefaultAction(GroovyConsoleActions.A_EXECUTE_SELECTION,
            I18N.tr("Execute selected"), I18N.tr("Run selected code"), GroovyIcon.getIcon("execute_selection"),
            EventHandler.create(ActionListener.class, this, "onExecuteSelected"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_DOWN_MASK)).setLogicalGroup("custom")
                    .setAfter(GroovyConsoleActions.A_EXECUTE);
    actions.addAction(executeSelectedAction);

    //Clear action
    clearAction = new DefaultAction(GroovyConsoleActions.A_CLEAR, I18N.tr("Clear"),
            I18N.tr("Erase the content of the editor"), GroovyIcon.getIcon("erase"),
            EventHandler.create(ActionListener.class, this, "onClear"), null);
    actions.addAction(clearAction);

    //Open action
    actions.addAction(new DefaultAction(GroovyConsoleActions.A_OPEN, I18N.tr("Open"),
            I18N.tr("Load a file in this editor"), GroovyIcon.getIcon("open"),
            EventHandler.create(ActionListener.class, this, "onOpenFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)));
    //Save
    saveAction = new DefaultAction(GroovyConsoleActions.A_SAVE, I18N.tr("Save"),
            I18N.tr("Save the editor content into a file"), GroovyIcon.getIcon("save"),
            EventHandler.create(ActionListener.class, this, "onSaveFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(saveAction);
    // Save As
    saveAsAction = new DefaultAction(GroovyConsoleActions.A_SAVE, I18N.tr("Save As"),
            I18N.tr("Save the editor content into a new file"), GroovyIcon.getIcon("page_white_save"),
            EventHandler.create(ActionListener.class, this, "onSaveAsNewFile"),
            KeyStroke.getKeyStroke("ctrl maj s"));
    actions.addAction(saveAsAction);
    //Find action
    findAction = new DefaultAction(GroovyConsoleActions.A_SEARCH, I18N.tr("Search.."),
            I18N.tr("Search text in the document"), GroovyIcon.getIcon("find"),
            EventHandler.create(ActionListener.class, this, "openFindReplaceDialog"),
            KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))
                    .addStroke(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(findAction);

    // Comment/Uncomment
    commentAction = new DefaultAction(GroovyConsoleActions.A_COMMENT, I18N.tr("(Un)comment"),
            I18N.tr("(Un)comment the selected text"), null,
            EventHandler.create(ActionListener.class, this, "onComment"), KeyStroke.getKeyStroke("alt C"))
                    .setLogicalGroup("format");
    actions.addAction(commentAction);

    // Block Comment/Uncomment
    blockCommentAction = new DefaultAction(GroovyConsoleActions.A_BLOCKCOMMENT, I18N.tr("Block (un)comment"),
            I18N.tr("Block (un)comment the selected text."), null,
            EventHandler.create(ActionListener.class, this, "onBlockComment"),
            KeyStroke.getKeyStroke("alt shift C")).setLogicalGroup("format");
    actions.addAction(blockCommentAction);
}

From source file:org.orbisgis.r.RConsolePanel.java

/**
 * Create actions instances/* w  w w  .j a v  a2  s.c  om*/
 *
 * Each action is put in the Popup menu and the tool bar Their shortcuts are
 * registered also in the editor
 */
private void initActions() {
    //Execute action
    executeAction = new DefaultAction(RConsoleActions.A_EXECUTE, I18N.tr("Execute"),
            I18N.tr("Execute the R script"), RIcon.getIcon("execute"),
            EventHandler.create(ActionListener.class, this, "onExecute"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(executeAction);

    //Execute Selected SQL
    executeSelectedAction = new DefaultAction(RConsoleActions.A_EXECUTE_SELECTION, I18N.tr("Execute selected"),
            I18N.tr("Run selected code"), RIcon.getIcon("execute_selection"),
            EventHandler.create(ActionListener.class, this, "onExecuteSelected"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_DOWN_MASK)).setLogicalGroup("custom")
                    .setAfter(RConsoleActions.A_EXECUTE);
    actions.addAction(executeSelectedAction);

    //Clear action
    clearAction = new DefaultAction(RConsoleActions.A_CLEAR, I18N.tr("Clear"),
            I18N.tr("Erase the content of the editor"), RIcon.getIcon("erase"),
            EventHandler.create(ActionListener.class, this, "onClear"), null);
    actions.addAction(clearAction);

    //Open action
    actions.addAction(
            new DefaultAction(RConsoleActions.A_OPEN, I18N.tr("Open"), I18N.tr("Load a file in this editor"),
                    RIcon.getIcon("open"), EventHandler.create(ActionListener.class, this, "onOpenFile"),
                    KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)));
    //Save
    saveAction = new DefaultAction(RConsoleActions.A_SAVE, I18N.tr("Save"),
            I18N.tr("Save the editor content into a file"), RIcon.getIcon("save"),
            EventHandler.create(ActionListener.class, this, "onSaveFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(saveAction);
    // Save As
    saveAsAction = new DefaultAction(RConsoleActions.A_SAVE, I18N.tr("Save As"),
            I18N.tr("Save the editor content into a new file"), RIcon.getIcon("page_white_save"),
            EventHandler.create(ActionListener.class, this, "onSaveAsNewFile"),
            KeyStroke.getKeyStroke("ctrl maj s"));
    actions.addAction(saveAsAction);
    //Find action
    findAction = new DefaultAction(RConsoleActions.A_SEARCH, I18N.tr("Search.."),
            I18N.tr("Search text in the document"), RIcon.getIcon("find"),
            EventHandler.create(ActionListener.class, this, "openFindReplaceDialog"),
            KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))
                    .addStroke(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(findAction);

    // Comment/Uncomment
    commentAction = new DefaultAction(RConsoleActions.A_COMMENT, I18N.tr("(Un)comment"),
            I18N.tr("(Un)comment the selected text"), null,
            EventHandler.create(ActionListener.class, this, "onComment"), KeyStroke.getKeyStroke("alt C"))
                    .setLogicalGroup("format");
    actions.addAction(commentAction);

}

From source file:org.orbisgis.sqlconsole.ui.SQLConsolePanel.java

/**
 * Create actions instances//from  w ww  .ja  va2s .  c o m
 * 
 * Each action is put in the Popup menu and the tool bar
 * Their shortcuts are registered also in the editor
 */
private void initActions() {
    //Execute Action
    executeAction = new DefaultAction(SQLAction.A_EXECUTE, I18N.tr("Execute"), I18N.tr("Run SQL statements"),
            SQLConsoleIcon.getIcon("execute"), EventHandler.create(ActionListener.class, this, "onExecute"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom");
    actions.addAction(executeAction);
    //Execute Selected SQL
    executeSelectedAction = new DefaultAction(SQLAction.A_EXECUTE_SELECTION, I18N.tr("Execute selected"),
            I18N.tr("Run selected SQL statements"), SQLConsoleIcon.getIcon("execute_selection"),
            EventHandler.create(ActionListener.class, this, "onExecuteSelected"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_DOWN_MASK)).setLogicalGroup("custom")
                    .setAfter(SQLAction.A_EXECUTE);
    actions.addAction(executeSelectedAction);
    //Clear action
    clearAction = new DefaultAction(SQLAction.A_CLEAR, I18N.tr("Clear"),
            I18N.tr("Erase the content of the editor"), SQLConsoleIcon.getIcon("erase"),
            EventHandler.create(ActionListener.class, this, "onClear"), null).setLogicalGroup("custom")
                    .setAfter(SQLAction.A_EXECUTE_SELECTION);
    actions.addAction(clearAction);
    //Find action
    findAction = new DefaultAction(SQLAction.A_SEARCH, I18N.tr("Search.."),
            I18N.tr("Search text in the document"), SQLConsoleIcon.getIcon("find"),
            EventHandler.create(ActionListener.class, this, "openFindReplaceDialog"),
            KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))
                    .addStroke(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK))
                    .setLogicalGroup("custom");
    actions.addAction(findAction);

    //Quote
    quoteAction = new DefaultAction(SQLAction.A_QUOTE, I18N.tr("Quote"), I18N.tr("Quote selected text"), null,
            EventHandler.create(ActionListener.class, this, "onQuote"),
            KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, InputEvent.SHIFT_DOWN_MASK)).setLogicalGroup("format");
    actions.addAction(quoteAction);
    //unQuote
    unQuoteAction = new DefaultAction(SQLAction.A_UNQUOTE, I18N.tr("Un Quote"),
            I18N.tr("Un Quote selected text"), null,
            EventHandler.create(ActionListener.class, this, "onUnQuote"),
            KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, InputEvent.SHIFT_DOWN_MASK))
                    .setLogicalGroup("format");
    actions.addAction(unQuoteAction);

    // Comment/Uncomment
    commentAction = new DefaultAction(SQLAction.A_COMMENT, I18N.tr("(Un)comment"),
            I18N.tr("(Un)comment the selected text"), null,
            EventHandler.create(ActionListener.class, this, "onComment"), KeyStroke.getKeyStroke("alt C"))
                    .setLogicalGroup("format");
    actions.addAction(commentAction);

    // Block Comment/Uncomment
    blockCommentAction = new DefaultAction(SQLAction.A_BLOCKCOMMENT, I18N.tr("Block (un)comment"),
            I18N.tr("Block (un)comment the selected text."), null,
            EventHandler.create(ActionListener.class, this, "onBlockComment"),
            KeyStroke.getKeyStroke("alt shift C")).setLogicalGroup("format");
    actions.addAction(blockCommentAction);

    //Format SQL
    formatSQLAction = new DefaultAction(SQLAction.A_FORMAT, I18N.tr("Format"), I18N.tr("Format editor content"),
            null, EventHandler.create(ActionListener.class, this, "onFormatCode"),
            KeyStroke.getKeyStroke("alt shift F")).setLogicalGroup("format");
    actions.addAction(formatSQLAction);

    //Save
    saveAction = new DefaultAction(SQLAction.A_SAVE, I18N.tr("Save"),
            I18N.tr("Save the editor content into a file"), SQLConsoleIcon.getIcon("save"),
            EventHandler.create(ActionListener.class, this, "onSaveFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom");
    actions.addAction(saveAction);
    // Save As
    saveAsAction = new DefaultAction(SQLAction.A_SAVE, I18N.tr("Save As"),
            I18N.tr("Save the editor content into a new file"), SQLConsoleIcon.getIcon("page_white_save"),
            EventHandler.create(ActionListener.class, this, "onSaveAsNewFile"),
            KeyStroke.getKeyStroke("ctrl maj s")).setLogicalGroup("custom");
    actions.addAction(saveAsAction);

    //Open action
    actions.addAction(new DefaultAction(SQLAction.A_OPEN, I18N.tr("Open"),
            I18N.tr("Load a file in this editor"), SQLConsoleIcon.getIcon("open"),
            EventHandler.create(ActionListener.class, this, "onOpenFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom"));
    //ShowHide function list
    actions.addAction(new DefaultAction(SQLAction.A_SQL_LIST, I18N.tr("SQL list"),
            I18N.tr("Show/Hide SQL function list"), SQLConsoleIcon.getIcon("builtinfunctionmap"),
            EventHandler.create(ActionListener.class, this, "onShowHideFunctionPanel"), null)
                    .setLogicalGroup("custom"));
    //Time out action
    actions.addAction(new DefaultAction(SQLAction.A_SQL_TIMEOUT, I18N.tr("Timeout"),
            I18N.tr("Custom a time out to execute the SQL statement"), SQLConsoleIcon.getIcon("timeout_sql"),
            EventHandler.create(ActionListener.class, this, "onSQLTimeOut"),
            KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom"));
}

From source file:org.orbisgis.view.beanshell.BshConsolePanel.java

/**
 * Create actions instances//  www .  j  av  a  2s  .c  om
 * 
 * Each action is put in the Popup menu and the tool bar
 * Their shortcuts are registered also in the editor
 */
private void initActions() {
    //Execute action
    executeAction = new DefaultAction(BeanShellAction.A_EXECUTE, I18N.tr("Execute"),
            I18N.tr("Execute the java script"), OrbisGISIcon.getIcon("execute"),
            EventHandler.create(ActionListener.class, this, "onExecute"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(executeAction);

    //Clear action
    clearAction = new DefaultAction(BeanShellAction.A_CLEAR, I18N.tr("Clear"),
            I18N.tr("Erase the content of the editor"), OrbisGISIcon.getIcon("erase"),
            EventHandler.create(ActionListener.class, this, "onClear"), null);
    actions.addAction(clearAction);

    //Open action
    actions.addAction(
            new DefaultAction(BeanShellAction.A_OPEN, I18N.tr("Open"), I18N.tr("Load a file in this editor"),
                    OrbisGISIcon.getIcon("open"), EventHandler.create(ActionListener.class, this, "onOpenFile"),
                    KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)));
    //Save
    saveAction = new DefaultAction(BeanShellAction.A_SAVE, I18N.tr("Save"),
            I18N.tr("Save the editor content into a file"), OrbisGISIcon.getIcon("save"),
            EventHandler.create(ActionListener.class, this, "onSaveFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(saveAction);
    //Find action
    findAction = new DefaultAction(BeanShellAction.A_SEARCH, I18N.tr("Search.."),
            I18N.tr("Search text in the document"), OrbisGISIcon.getIcon("find"),
            EventHandler.create(ActionListener.class, this, "openFindReplaceDialog"),
            KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))
                    .addStroke(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK));
    actions.addAction(findAction);

}

From source file:org.orbisgis.view.sqlconsole.ui.SQLConsolePanel.java

/**
 * Create actions instances//www. ja  v  a2 s .  c om
 * 
 * Each action is put in the Popup menu and the tool bar
 * Their shortcuts are registered also in the editor
 */
private void initActions() {
    //Execute Action
    executeAction = new DefaultAction(SQLAction.A_EXECUTE, I18N.tr("Execute"), I18N.tr("Run SQL statements"),
            OrbisGISIcon.getIcon("execute"), EventHandler.create(ActionListener.class, this, "onExecute"),
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom");
    actions.addAction(executeAction);
    //Clear action
    clearAction = new DefaultAction(SQLAction.A_CLEAR, I18N.tr("Clear"),
            I18N.tr("Erase the content of the editor"), OrbisGISIcon.getIcon("erase"),
            EventHandler.create(ActionListener.class, this, "onClear"), null).setLogicalGroup("custom")
                    .setAfter(SQLAction.A_EXECUTE);
    actions.addAction(clearAction);
    //Find action
    findAction = new DefaultAction(SQLAction.A_SEARCH, I18N.tr("Search.."),
            I18N.tr("Search text in the document"), OrbisGISIcon.getIcon("find"),
            EventHandler.create(ActionListener.class, this, "openFindReplaceDialog"),
            KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))
                    .addStroke(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK))
                    .setLogicalGroup("custom");
    actions.addAction(findAction);

    //Quote
    quoteAction = new DefaultAction(SQLAction.A_QUOTE, I18N.tr("Quote"), I18N.tr("Quote selected text"), null,
            EventHandler.create(ActionListener.class, this, "onQuote"),
            KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, InputEvent.SHIFT_DOWN_MASK)).setLogicalGroup("format");
    actions.addAction(quoteAction);
    //unQuote
    unQuoteAction = new DefaultAction(SQLAction.A_UNQUOTE, I18N.tr("Un Quote"),
            I18N.tr("Un Quote selected text"), null,
            EventHandler.create(ActionListener.class, this, "onUnQuote"),
            KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, InputEvent.SHIFT_DOWN_MASK))
                    .setLogicalGroup("format");
    actions.addAction(unQuoteAction);

    //Format SQL
    formatSQLAction = new DefaultAction(SQLAction.A_FORMAT, I18N.tr("Format"), I18N.tr("Format editor content"),
            null, EventHandler.create(ActionListener.class, this, "onFormatCode"),
            KeyStroke.getKeyStroke("alt shift F")).setLogicalGroup("format");
    actions.addAction(formatSQLAction);

    //Save
    saveAction = new DefaultAction(SQLAction.A_SAVE, I18N.tr("Save"),
            I18N.tr("Save the editor content into a file"), OrbisGISIcon.getIcon("save"),
            EventHandler.create(ActionListener.class, this, "onSaveFile"),
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)).setLogicalGroup("custom");
    actions.addAction(saveAction);
    //Open action
    actions.addAction(
            new DefaultAction(SQLAction.A_OPEN, I18N.tr("Open"), I18N.tr("Load a file in this editor"),
                    OrbisGISIcon.getIcon("open"), EventHandler.create(ActionListener.class, this, "onOpenFile"),
                    KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK))
                            .setLogicalGroup("custom"));
    //ShowHide function list
    actions.addAction(new DefaultAction(SQLAction.A_SQL_LIST, I18N.tr("SQL list"),
            I18N.tr("Show/Hide SQL function list"), OrbisGISIcon.getIcon("builtinfunctionmap"),
            EventHandler.create(ActionListener.class, sqlFunctionsPanel, "switchPanelVisibilityState"), null)
                    .setLogicalGroup("custom"));
}

From source file:org.photovault.swingui.PhotoCollectionThumbView.java

protected void handleDnDDragEvent(MouseEvent e) {
    //Don't bother to drag if no photo is selected
    if (selection.isEmpty()) {
        return;/*from   w w  w .ja  v  a2 s  .  c o  m*/
    }

    if (firstMouseEvent != null) {
        log.debug("considering drag");
        e.consume();

        //If they are holding down the control key, COPY rather than MOVE
        int ctrlMask = InputEvent.CTRL_DOWN_MASK;
        int action = e.isControlDown() ? TransferHandler.COPY : TransferHandler.MOVE;

        int dx = Math.abs(e.getX() - firstMouseEvent.getX());
        int dy = Math.abs(e.getY() - firstMouseEvent.getY());
        //Arbitrarily define a 5-pixel shift as the
        //official beginning of a drag.
        if (dx > 5 || dy > 5) {
            log.debug("Start a drag");
            //This is a drag, not a click.
            JComponent c = (JComponent) e.getSource();
            //Tell the transfer handler to initiate the drag.
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, firstMouseEvent, action);
            firstMouseEvent = null;
        }
    }
}

From source file:org.pmedv.blackboard.commands.AddDiodeCommand.java

public AddDiodeCommand() {
    putValue(Action.NAME, resources.getResourceByKey("AddDiodeCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.diode"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("AddDiodeCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//from w  ww .  ja  v  a2 s.  co  m
}

From source file:org.pmedv.blackboard.commands.AddResistorCommand.java

public AddResistorCommand() {
    putValue(Action.NAME, resources.getResourceByKey("AddResistorCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.resistor"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("AddResistorCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);// w w w .j av  a2s  .  c  o m
}