From 5a1a5006131a95cb46d20ae872ab9e9f1d2bc7b6 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Tue, 5 Aug 2014 14:35:57 +0400 Subject: [PATCH 1/2] IDEA-71036 diff: remove Copy/Find buttons from toolbar - merge too They were disabled everywhere for at least few years. Nobody blames, so nobody needs --- .../openapi/diff/impl/incrementalMerge/ui/MergePanel2.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index 091ac47c7251..cbad541fe129 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -143,9 +143,6 @@ public class MergePanel2 implements DiffViewer { private DiffRequest.ToolbarAddons createToolbar() { return new DiffRequest.ToolbarAddons() { public void customize(DiffToolbar toolbar) { - ActionManager actionManager = ActionManager.getInstance(); - toolbar.addAction(actionManager.getAction(IdeActions.ACTION_COPY)); - toolbar.addAction(actionManager.getAction(IdeActions.ACTION_FIND)); toolbar.addAction(PreviousDiffAction.find()); toolbar.addAction(NextDiffAction.find()); toolbar.addSeparator(); From 3875bbb3e9d636e585807415e125968359f58619 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Tue, 5 Aug 2014 14:46:56 +0400 Subject: [PATCH 2/2] gulp rc: update task list on gulpfile change --- .../src/com/intellij/util/ui/SwingHelper.java | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java index 59d1143b6bbd..35719ca9366b 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java +++ b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java @@ -275,20 +275,7 @@ public class SwingHelper { textFieldWithHistory.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - List newHistory = historyProvider.produce(); - Set newHistorySet = ContainerUtil.newHashSet(newHistory); - List oldHistory = textFieldWithHistory.getHistory(); - List mergedHistory = ContainerUtil.newArrayList(); - for (String item : oldHistory) { - if (!newHistorySet.contains(item)) { - mergedHistory.add(item); - } - } - mergedHistory.addAll(newHistory); - textFieldWithHistory.setHistory(mergedHistory); - - setLongestAsPrototype(textFieldWithHistory, mergedHistory); - + setHistory(textFieldWithHistory, historyProvider.produce(), true); // one-time initialization textFieldWithHistory.removePopupMenuListener(this); } @@ -303,6 +290,30 @@ public class SwingHelper { }); } + public static void setHistory(@NotNull TextFieldWithHistory textFieldWithHistory, + @NotNull List history, + boolean mergeWithPrevHistory) { + Set newHistorySet = ContainerUtil.newHashSet(history); + List prevHistory = textFieldWithHistory.getHistory(); + List mergedHistory = ContainerUtil.newArrayList(); + if (mergeWithPrevHistory) { + for (String item : prevHistory) { + if (!newHistorySet.contains(item)) { + mergedHistory.add(item); + } + } + } + else { + String currentText = textFieldWithHistory.getText(); + if (StringUtil.isNotEmpty(currentText) && !newHistorySet.contains(currentText)) { + mergedHistory.add(currentText); + } + } + mergedHistory.addAll(history); + textFieldWithHistory.setHistory(mergedHistory); + setLongestAsPrototype(textFieldWithHistory, mergedHistory); + } + private static void setLongestAsPrototype(@NotNull JComboBox comboBox, @NotNull List variants) { Object prototypeDisplayValue = comboBox.getPrototypeDisplayValue(); String prototypeDisplayValueStr = null; @@ -440,20 +451,23 @@ public class SwingHelper { editorPane.setText(html); } + @NotNull public static TextFieldWithHistoryWithBrowseButton createTextFieldWithHistoryWithBrowseButton(@Nullable Project project, @NotNull String browseDialogTitle, @NotNull FileChooserDescriptor fileChooserDescriptor, - @NotNull NotNullProducer> historyProvider) { + @Nullable NotNullProducer> historyProvider) { TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton(); - final TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent(); + TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); - addHistoryOnExpansion(textFieldWithHistory, historyProvider); + if (historyProvider != null) { + addHistoryOnExpansion(textFieldWithHistory, historyProvider); + } installFileCompletionAndBrowseDialog( project, textFieldWithHistoryWithBrowseButton, - browseDialogTitle, fileChooserDescriptor - + browseDialogTitle, + fileChooserDescriptor ); return textFieldWithHistoryWithBrowseButton; }