Example usage for com.intellij.openapi.actionSystem CommonShortcuts getNew

List of usage examples for com.intellij.openapi.actionSystem CommonShortcuts getNew

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem CommonShortcuts getNew.

Prototype

public static ShortcutSet getNew() 

Source Link

Usage

From source file:com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel.java

License:Apache License

public ArrangementSettingsPanel(@NotNull CodeStyleSettings settings, @NotNull Language language) {
    super(settings);
    myLanguage = language;/*from   w  w  w  . j  a v a  2  s  . c o m*/
    Rearranger<?> rearranger = Rearranger.EXTENSION.forLanguage(language);

    assert rearranger instanceof ArrangementStandardSettingsAware;
    mySettingsAware = (ArrangementStandardSettingsAware) rearranger;

    final ArrangementColorsProvider colorsProvider;
    if (rearranger instanceof ArrangementColorsAware) {
        colorsProvider = new ArrangementColorsProviderImpl((ArrangementColorsAware) rearranger);
    } else {
        colorsProvider = new ArrangementColorsProviderImpl(null);
    }

    ArrangementStandardSettingsManager settingsManager = new ArrangementStandardSettingsManager(mySettingsAware,
            colorsProvider);

    myGroupingRulesPanel = new ArrangementGroupingRulesPanel(settingsManager, colorsProvider);
    myMatchingRulesPanel = new ArrangementMatchingRulesPanel(myLanguage, settingsManager, colorsProvider);

    myContent.add(myGroupingRulesPanel, new GridBag().coverLine().fillCellHorizontally().weightx(1));
    myContent.add(myMatchingRulesPanel, new GridBag().fillCell().weightx(1).weighty(1).coverLine());

    if (settings.getCommonSettings(myLanguage).isForceArrangeMenuAvailable()) {
        myForceArrangementPanel = new ForceArrangementPanel();
        myForceArrangementPanel.setSelectedMode(settings.getCommonSettings(language).FORCE_REARRANGE_MODE);
        myContent.add(myForceArrangementPanel.getPanel(),
                new GridBag().anchor(GridBagConstraints.WEST).coverLine().fillCellHorizontally());
    } else {
        myForceArrangementPanel = null;
    }

    final List<CompositeArrangementSettingsToken> groupingTokens = settingsManager.getSupportedGroupingTokens();
    myGroupingRulesPanel.setVisible(groupingTokens != null && !groupingTokens.isEmpty());

    registerShortcut(ArrangementConstants.MATCHING_RULE_ADD, CommonShortcuts.getNew(), myMatchingRulesPanel);
    registerShortcut(ArrangementConstants.MATCHING_RULE_REMOVE, CommonShortcuts.getDelete(),
            myMatchingRulesPanel);
    registerShortcut(ArrangementConstants.MATCHING_RULE_MOVE_UP, CommonShortcuts.MOVE_UP, myMatchingRulesPanel);
    registerShortcut(ArrangementConstants.MATCHING_RULE_MOVE_DOWN, CommonShortcuts.MOVE_DOWN,
            myMatchingRulesPanel);
    final CustomShortcutSet edit = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    registerShortcut(ArrangementConstants.MATCHING_RULE_EDIT, edit, myMatchingRulesPanel);

    registerShortcut(ArrangementConstants.GROUPING_RULE_MOVE_UP, CommonShortcuts.MOVE_UP, myGroupingRulesPanel);
    registerShortcut(ArrangementConstants.GROUPING_RULE_MOVE_DOWN, CommonShortcuts.MOVE_DOWN,
            myGroupingRulesPanel);
}

From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabFormImpl.java

License:Open Source License

/**
 * Create the action buttons for the toolbar
 *
 * @return action toolbar//from  w  w  w  .  jav  a  2  s  .  c om
 */
protected DefaultActionGroup createActionsGroup() {
    final AnAction createAction = new AnAction(TfPluginBundle.message(createDialogTitle),
            TfPluginBundle.message(createDialogTitle), AllIcons.ToolbarDecorator.Add) {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            listenerContainer.triggerEvent(this, CMD_CREATE_NEW_ITEM);
        }
    };
    createAction.registerCustomShortcutSet(CommonShortcuts.getNew(), scrollPanel); //Ctrl+N on windows or Cmd+M on Mac

    final AnAction refreshAction = new AnAction(TfPluginBundle.message(refreshTooltip),
            TfPluginBundle.message(refreshTooltip), AllIcons.Actions.Refresh) {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            listenerContainer.triggerEvent(this, CMD_REFRESH);
        }
    };
    refreshAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), scrollPanel); //Ctrl+R on windows or Cmd+R on Mac

    return new DefaultActionGroup(createAction, refreshAction);
}

From source file:com.microsoft.alm.plugin.idea.ui.common.tabs.TabFormImpl.java

License:Open Source License

/**
 * Create the action buttons for the toolbar
 *
 * @return action toolbar//from  ww  w.  ja  v a  2 s . co m
 */
protected DefaultActionGroup createActionsGroup() {
    final AnAction createAction = new AnAction(TfPluginBundle.message(createDialogTitle),
            TfPluginBundle.message(createDialogTitle), AllIcons.ToolbarDecorator.Add) {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            setChangedAndNotify(CMD_CREATE_NEW_ITEM);
        }
    };
    createAction.registerCustomShortcutSet(CommonShortcuts.getNew(), scrollPanel); //Ctrl+N on windows or Cmd+M on Mac

    final AnAction refreshAction = new AnAction(TfPluginBundle.message(refreshTooltip),
            TfPluginBundle.message(refreshTooltip), AllIcons.Actions.Refresh) {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            setChangedAndNotify(CMD_REFRESH);
        }
    };
    refreshAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), scrollPanel); //Ctrl+R on windows or Cmd+R on Mac

    return new DefaultActionGroup(createAction, refreshAction);
}

From source file:com.vladsch.MissingInActions.util.CommonUIShortcuts.java

License:Apache License

public static ShortcutSet getNew() {
    return CommonShortcuts.getNew();
}