IDEA-182879 vcs: remove rarely used actions from "Local History" toolbar

This commit is contained in:
Aleksey Pivovarov
2018-05-01 14:53:28 +03:00
parent bb9c13dc41
commit 465c57fe22
@@ -30,6 +30,7 @@ import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction;
import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffContext;
import com.intellij.openapi.vcs.changes.ui.ChangesTreeImpl;
import com.intellij.openapi.vcs.changes.ui.TreeActionsToolbarPanel;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.*;
import com.intellij.util.containers.ContainerUtil;
@@ -70,20 +71,22 @@ public class DirectoryHistoryDialog extends HistoryDialog<DirectoryHistoryDialog
JPanel p = new JPanel(new BorderLayout());
myToolBar = ActionManager.getInstance().createActionToolbar("DirectoryHistoryDiffPanel", createChangesTreeActions(root), true);
JPanel toolBarPanel = new JPanel(new BorderLayout());
toolBarPanel.add(myToolBar.getComponent(), BorderLayout.CENTER);
myToolBar = ActionManager.getInstance().createActionToolbar("DirectoryHistoryDiffPanel", createChangesTreeActions(), true);
TreeActionsToolbarPanel toolbarPanel = new TreeActionsToolbarPanel(myToolBar, myChangesTree);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(toolbarPanel, BorderLayout.CENTER);
if (showSearchField()) {
SearchTextField search = createSearchBox(root);
toolBarPanel.add(search, BorderLayout.EAST);
topPanel.add(search, BorderLayout.EAST);
traversalPolicy.exclude(search.getTextEditor());
}
p.add(toolBarPanel, BorderLayout.NORTH);
p.add(topPanel, BorderLayout.NORTH);
p.add(myChangesTreeScrollPane = ScrollPaneFactory.createScrollPane(myChangesTree), BorderLayout.CENTER);
return Pair.create(p, toolBarPanel.getPreferredSize());
return Pair.create(p, topPanel.getPreferredSize());
}
protected boolean showSearchField() {
@@ -115,17 +118,16 @@ public class DirectoryHistoryDialog extends HistoryDialog<DirectoryHistoryDialog
private void initChangesTree(JComponent root) {
myChangesTree = new ChangesTreeImpl.Changes(myProject, false, false);
myChangesTree.setDoubleClickHandler(() -> new ShowDifferenceAction().performIfEnabled());
myChangesTree.installPopupHandler(createChangesTreeActions(root));
new ShowDifferenceAction().registerCustomShortcutSet(root, null);
myChangesTree.installPopupHandler(createChangesTreeActions());
}
private ActionGroup createChangesTreeActions(JComponent root) {
private ActionGroup createChangesTreeActions() {
DefaultActionGroup result = new DefaultActionGroup();
ShowDifferenceAction a = new ShowDifferenceAction();
a.registerCustomShortcutSet(CommonShortcuts.getDiff(), root);
result.add(a);
result.add(new ShowDifferenceAction());
result.add(new RevertSelectionAction());
result.addSeparator();
result.addAll(myChangesTree.getTreeActions());
return result;
}
@@ -157,6 +159,7 @@ public class DirectoryHistoryDialog extends HistoryDialog<DirectoryHistoryDialog
private class ShowDifferenceAction extends ActionOnSelection {
public ShowDifferenceAction() {
super(message("action.show.difference"), AllIcons.Actions.Diff);
setShortcutSet(CommonShortcuts.getDiff());
}
@Override