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);
  }
Beispiel #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);
 }
    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);
        }
      }
    }