// todo terrible constructor public MultipleChangeListBrowser( Project project, List<? extends ChangeList> changeLists, List<Change> changes, Disposable parentDisposable, ChangeList initialListSelection, boolean capableOfExcludingChanges, boolean highlightProblems, Runnable rebuildListListener, @Nullable Runnable inclusionListener, AnAction... additionalActions) { super( project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES, null); myParentDisposable = parentDisposable; myRebuildListListener = rebuildListListener; myChangeListChooser = new ChangeListChooser(changeLists); myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST); myShowingAllChangeLists = Comparing.haveEqualElements( changeLists, ChangeListManager.getInstance(project).getChangeLists()); ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener); myExtender = new Extender(project, this, additionalActions); ActionManager actionManager = ActionManager.getInstance(); final AnAction moveAction = actionManager.getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST); actionManager.addAnActionListener( new AnActionListener.Adapter() { @Override public void afterActionPerformed( AnAction action, DataContext dataContext, AnActionEvent event) { if (moveAction.equals(action)) { rebuildList(); } } }, myParentDisposable); }
@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)); }
@NotNull protected JComponent createToolbar() { DefaultActionGroup toolbarGroups = new DefaultActionGroup(); myToolBarGroup = new DefaultActionGroup(); toolbarGroups.add(myToolBarGroup); buildToolBar(myToolBarGroup); toolbarGroups.addSeparator(); DefaultActionGroup treeActionsGroup = new DefaultActionGroup(); toolbarGroups.add(treeActionsGroup); for (AnAction action : myViewer.getTreeActions()) { treeActionsGroup.add(action); } ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, toolbarGroups, true); toolbar.setTargetComponent(this); return toolbar.getComponent(); }
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); } } }
private void updateMenu() { PopupHandler.installPopupHandler( this, myMenuGroup, ActionPlaces.CHANGES_VIEW_POPUP, ActionManager.getInstance()); }