[vcs-log] better text and description for IntelliSort

This commit is contained in:
Julia Beliaeva
2015-03-16 01:51:12 +03:00
parent 2b7ef5ffbe
commit 32e003e507
3 changed files with 13 additions and 6 deletions
@@ -45,9 +45,9 @@ public interface PermanentGraph<CommitId> {
Set<CommitId> getContainingBranches(@NotNull CommitId commit);
enum SortType {
Normal("Off", "Sort commits topologically and by date."),
Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)."),
LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased.");
Normal("Off", "Sort commits topologically and by date"),
Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)"),
LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased");
@NotNull private final String myPresentation;
@NotNull private final String myDescription;
@@ -79,7 +79,7 @@ public class IntelliSortChooserPopupAction extends DumbAwareAction {
private final VcsLogUi myUI;
public SelectIntelliSortTypeAction(VcsLogUi logUi, PermanentGraph.SortType sortType) {
super(sortType.getName(), sortType.getDescription(), null);
super(sortType.getName(), sortType.getDescription() + ".", null);
myUI = logUi;
mySortType = sortType;
}
@@ -27,10 +27,11 @@ import icons.VcsLogIcons;
import org.jetbrains.annotations.NotNull;
public class IntelliSortChooserToggleAction extends ToggleAction implements DumbAware {
@NotNull private static final String DEFAULT_TEXT = "IntelliSort";
@NotNull private static final String DEFAULT_DESCRIPTION = "Turn IntelliSort On/Off";
public IntelliSortChooserToggleAction() {
super("IntelliSort", DEFAULT_DESCRIPTION, IconUtil.flip(VcsLogIcons.Branch, false));
super(DEFAULT_TEXT, DEFAULT_DESCRIPTION, IconUtil.flip(VcsLogIcons.Branch, false));
}
@Override
@@ -54,9 +55,15 @@ public class IntelliSortChooserToggleAction extends ToggleAction implements Dumb
e.getPresentation().setEnabled(BekSorter.isBekEnabled() && logUI != null);
if (logUI != null) {
e.getPresentation().setDescription("Turn IntelliSort " + (logUI.getBekType() == PermanentGraph.SortType.Normal ? "On" : "Off" + ""));
boolean off = logUI.getBekType() == PermanentGraph.SortType.Normal;
e.getPresentation().setText("IntelliSort is " + (off ? "Off" : "On"));
e.getPresentation().setDescription("Turn IntelliSort " + (off ? "on" : "off") + " (" +
(off
? PermanentGraph.SortType.Bek.getDescription().toLowerCase()
: PermanentGraph.SortType.Normal.getDescription().toLowerCase()) + ").");
}
else {
e.getPresentation().setText(DEFAULT_TEXT);
e.getPresentation().setDescription(DEFAULT_DESCRIPTION);
}
}