*/
package com.intellij.openapi.vcs.changes.patch;
+import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diff.impl.patch.FilePatch;
import com.intellij.openapi.diff.impl.patch.PatchReader;
}
private class MyShowDiff extends AnAction {
+ private final MyChangeComparator myMyChangeComparator;
private MyShowDiff() {
super("Show Diff", "Show Diff", IconLoader.getIcon("/actions/diff.png"));
+ myMyChangeComparator = new MyChangeComparator();
}
public void update(AnActionEvent e) {
public void actionPerformed(AnActionEvent e) {
if (myPatches.isEmpty() || (! myContainBasedChanges)) return;
final List<FilePatchInProgress.PatchChange> changes = getAllChanges();
- Collections.sort(changes, MyChangeComparator.getInstance());
+ Collections.sort(changes, myMyChangeComparator);
final List<FilePatchInProgress.PatchChange> selectedChanges = myChangesTreeList.getSelectedChanges();
int selectedIdx = 0;
}
}
- private static class MyChangeComparator implements Comparator<FilePatchInProgress.PatchChange> {
- private static final MyChangeComparator ourInstance = new MyChangeComparator();
-
- public static MyChangeComparator getInstance() {
- return ourInstance;
- }
-
+ private class MyChangeComparator implements Comparator<FilePatchInProgress.PatchChange> {
public int compare(FilePatchInProgress.PatchChange o1, FilePatchInProgress.PatchChange o2) {
+ if (PropertiesComponent.getInstance(myProject).isTrueValue("ChangesBrowser.SHOW_FLATTEN")) {
+ return o1.getPatchInProgress().getIoCurrentBase().getName().compareTo(o2.getPatchInProgress().getIoCurrentBase().getName());
+ }
return o1.getPatchInProgress().getIoCurrentBase().compareTo(o2.getPatchInProgress().getIoCurrentBase());
}
}