private ActionToolbar createToolbar() {
    DefaultActionGroup group = new DefaultActionGroup();

    BackAction back = new BackAction();
    back.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)), this);
    group.add(back);

    ForwardAction forward = new ForwardAction();
    forward.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)), this);
    group.add(forward);

    EditSourceActionBase edit = new EditSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getEditSource(), CommonShortcuts.ENTER), this);
    group.add(edit);

    edit = new ShowSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getViewSource(), CommonShortcuts.CTRL_ENTER),
        this);
    group.add(edit);

    return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
  }
예제 #2
0
 private void registerShortcuts() {
   ActionManager actionManager = ActionManager.getInstance();
   actionManager
       .getAction(XDebuggerActions.SET_VALUE)
       .registerCustomShortcutSet(
           new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this);
   actionManager
       .getAction(XDebuggerActions.COPY_VALUE)
       .registerCustomShortcutSet(CommonShortcuts.getCopy(), this);
   actionManager
       .getAction(XDebuggerActions.JUMP_TO_SOURCE)
       .registerCustomShortcutSet(CommonShortcuts.getEditSource(), this);
   Shortcut[] editTypeShortcuts =
       KeymapManager.getInstance()
           .getActiveKeymap()
           .getShortcuts(XDebuggerActions.EDIT_TYPE_SOURCE);
   actionManager
       .getAction(XDebuggerActions.JUMP_TO_TYPE_SOURCE)
       .registerCustomShortcutSet(new CustomShortcutSet(editTypeShortcuts), this);
   actionManager
       .getAction(XDebuggerActions.MARK_OBJECT)
       .registerCustomShortcutSet(
           new CustomShortcutSet(
               KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")),
           this);
 }
  private JPanel createToolbarPanel() {
    RunAction runAction = new RunAction(this);
    runAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this);

    DefaultActionGroup leftActionGroup = new DefaultActionGroup();
    leftActionGroup.add(runAction);
    leftActionGroup.add(new PauseOutputAction(this));
    leftActionGroup.add(new StopAction(this));
    leftActionGroup.add(new CloseAction());
    leftActionGroup.add(new PreviousOccurenceToolbarAction(this));
    leftActionGroup.add(new NextOccurenceToolbarAction(this));
    leftActionGroup.add(new ContextHelpAction(HelpID.ANT));

    DefaultActionGroup rightActionGroup = new DefaultActionGroup();
    rightActionGroup.add(new ChangeViewAction(this));
    rightActionGroup.add(new VerboseAction(this));
    rightActionGroup.add(
        CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this));
    rightActionGroup.add(
        CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this));
    rightActionGroup.add(myTreeView.createToggleAutoscrollAction());

    myLeftToolbar =
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, leftActionGroup, false);
    JPanel toolbarPanel = new JPanel(new GridLayout(1, 2, 2, 0));
    toolbarPanel.add(myLeftToolbar.getComponent());
    myRightToolbar =
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, rightActionGroup, false);
    toolbarPanel.add(myRightToolbar.getComponent());

    return toolbarPanel;
  }
 public RerunAction(JComponent comp) {
   super(
       InspectionsBundle.message("inspection.action.rerun"),
       InspectionsBundle.message("inspection.action.rerun"),
       AllIcons.Actions.Rerun);
   registerCustomShortcutSet(CommonShortcuts.getRerun(), comp);
 }
 public RerunAction(JComponent comp) {
   super(
       CommonBundle.message("action.rerun"),
       AnalysisScopeBundle.message("action.rerun.dependency"),
       AllIcons.Actions.RefreshUsages);
   registerCustomShortcutSet(CommonShortcuts.getRerun(), comp);
 }
  public VariablesPanel(Project project, DebuggerStateManager stateManager, Disposable parent) {
    super(project, stateManager);

    setBorder(null);

    final FrameVariablesTree frameTree = getFrameTree();

    myCards = new JPanel(new CardLayout());
    myCards.add(frameTree, TREE);

    myXTree = new MyXVariablesView(project);
    registerDisposable(myXTree);
    myCards.add(myXTree.getTree(), X_TREE);

    JScrollPane pane = ScrollPaneFactory.createScrollPane(myCards);
    pane.getVerticalScrollBar().setUnitIncrement(10);
    add(pane, BorderLayout.CENTER);
    registerDisposable(
        DebuggerAction.installEditAction(frameTree, DebuggerActions.EDIT_NODE_SOURCE));

    overrideShortcut(frameTree, DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
    overrideShortcut(
        frameTree,
        DebuggerActions.SET_VALUE,
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)));

    new ValueNodeDnD(myTree, parent);
  }
  private RepositoryChangesBrowser createRepositoryChangesBrowser(final Project project) {
    TableView<ChangeInfo> table = changeListPanel.getTable();

    RepositoryChangesBrowser repositoryChangesBrowser =
        new RepositoryChangesBrowser(
            project,
            Collections.<CommittedChangeList>emptyList(),
            Collections.<Change>emptyList(),
            null);
    repositoryChangesBrowser
        .getDiffAction()
        .registerCustomShortcutSet(CommonShortcuts.getDiff(), table);
    repositoryChangesBrowser
        .getViewer()
        .setScrollPaneBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP));

    changeListPanel.addListSelectionListener(
        new Consumer<ChangeInfo>() {
          @Override
          public void consume(ChangeInfo changeInfo) {
            changeSelected(changeInfo, project);
          }
        });
    return repositoryChangesBrowser;
  }
 private ReRunAction() {
   super(
       UsageViewBundle.message("action.rerun"),
       UsageViewBundle.message("action.description.rerun"),
       IconLoader.getIcon("/actions/refreshUsages.png"));
   registerCustomShortcutSet(CommonShortcuts.getRerun(), myRootPanel);
 }
  @Override
  protected void buildToolBar(final DefaultActionGroup toolBarGroup) {
    super.buildToolBar(toolBarGroup);

    EmptyAction.registerWithShortcutSet(
        IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), myViewer);
    toolBarGroup.add(ActionManager.getInstance().getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST));
  }
예제 #10
0
 public MyDeleteAction(Condition<Object[]> availableCondition) {
   super(
       CommonBundle.message("button.delete"),
       CommonBundle.message("button.delete"),
       PlatformIcons.DELETE_ICON);
   registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree);
   myCondition = availableCondition;
 }
    public void addToolbarActions(final DialogWrapper dialogWrapper) {
      final Icon icon = AllIcons.Actions.Refresh;
      if (myBrowser.myChangesToDisplay == null) {
        myBrowser.addToolbarAction(
            new AnAction("Refresh Changes") {
              @Override
              public void actionPerformed(AnActionEvent e) {
                myBrowser.rebuildList();
              }

              @Override
              public void update(AnActionEvent e) {
                e.getPresentation().setIcon(icon);
              }
            });
      }
      RollbackDialogAction rollback = new RollbackDialogAction();
      EmptyAction.setupAction(rollback, IdeActions.CHANGES_VIEW_ROLLBACK, myBrowser);
      myBrowser.addToolbarAction(rollback);

      final EditSourceForDialogAction editSourceAction = new EditSourceForDialogAction(myBrowser);
      editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myBrowser);
      myBrowser.addToolbarAction(editSourceAction);

      myBrowser.addToolbarAction(
          ActionManager.getInstance().getAction("Vcs.CheckinProjectToolbar"));

      final List<AnAction> actions =
          AdditionalLocalChangeActionsInstaller.calculateActions(
              myProject, myBrowser.getAllChanges());
      if (actions != null) {
        for (AnAction action : actions) {
          myBrowser.addToolbarAction(action);
        }
      }
      if (myAdditionalActions != null && myAdditionalActions.length > 0) {
        for (AnAction action : myAdditionalActions) {
          myBrowser.addToolbarAction(action);
        }
      }
    }
예제 #12
0
  private DefaultActionGroup createActionGroup() {
    DefaultActionGroup actionGroup = new DefaultActionGroup();
    if (ApplicationManager.getApplication() == null || Pico.isUnitTest()) return actionGroup;

    addRefreshAction(actionGroup);
    myOpenFileAction = new OpenFileAction(myTree, myIdeFacade);
    myOpenFileAction.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0)), myTree);

    AnAction diffAction =
        new DiffAction(myTree) {
          protected User getUser() {
            return myUser;
          }
        };

    diffAction.registerCustomShortcutSet(CommonShortcuts.getDiff(), myTree);

    actionGroup.add(myOpenFileAction);
    actionGroup.add(diffAction);

    addToggleReadOnlyAction(actionGroup);
    return actionGroup;
  }
  public ArrangementSettingsPanel(@NotNull CodeStyleSettings settings, @NotNull Language language) {
    super(settings);
    myLanguage = language;
    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);
  }