mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[vcs-log] refactor IntelliSort actions
* Always display all available sort options in a list instead of using a single toggle action. * Separate sort actions from the branch actions. * Improve action text. GitOrigin-RevId: 3768672b2176fbfe6e8f6ac149a53ca857ac3d14
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c676d256e2
commit
96408c28cf
@@ -743,7 +743,6 @@ vcs.log.bek.sort.disabled=false
|
||||
vcs.log.bek.sort.disabled.description=Disable IntelliSort
|
||||
vcs.log.linear.bek.sort=false
|
||||
vcs.log.linear.bek.sort.description=Third kind of IntelliSort that simplifies merges and tries to show history as linear
|
||||
vcs.log.linear.bek.sort.restartRequired=true
|
||||
vcs.log.recent.commits.count=1000
|
||||
vcs.log.recent.commits.count.description=Before full log is loaded (which can take some time), a number of recent commits is loaded to be shown quickly
|
||||
vcs.log.recent.commits.count.restartRequired=true
|
||||
|
||||
@@ -29,7 +29,7 @@ action.process.expanding.linear.branches=Expanding linear branches\u2026
|
||||
action.process.expanding.merges=Expanding merges\u2026
|
||||
action.description.expand.merges=Expand merges
|
||||
action.title.expand.merges=Expand Merges
|
||||
action.vcs.log.branches.separator=Branches
|
||||
action.vcs.log.branches.separator=Branch Actions
|
||||
action.description.expand.linear.branches=Expand linear branches
|
||||
action.title.expand.linear.branches=Expand Linear Branches
|
||||
action.process.collapsing.linear.branches=Collapsing linear branches\u2026
|
||||
@@ -60,19 +60,15 @@ action.description.select.columns.to.see=Select columns to see in the table
|
||||
action.title.select.columns.to.see=Columns
|
||||
action.FocusTextFilterAction.text=Focus Text Filter
|
||||
action.FocusTextFilterAction.description=Focus text filter or move focus back to the commits list
|
||||
action.IntelliSortChooserPopupAction.text=IntelliSort
|
||||
action.IntelliSortChooserPopupAction.description=Change IntelliSort type
|
||||
action.vcs.log.sort.type.separator=Sort
|
||||
group.Vcs.Log.SortTypeGroup.text=VCS Log Sort Type
|
||||
group.Vcs.Log.SortTypeGroup.description=Select the VCS log sort type
|
||||
action.ShowCommitTooltipAction.text=Show Commit Tooltip
|
||||
action.ShowCommitTooltipAction.description=Show tooltip for currently selected commit in the Log
|
||||
action.presentation.CompareRevisionsFromFileHistoryActionProvider.text.compare=Compare
|
||||
action.presentation.CompareRevisionsFromFileHistoryActionProvider.text.show.diff=Show Diff
|
||||
action.presentation.CompareRevisionsFromFileHistoryActionProvider.description.compare=Compare selected versions
|
||||
action.presentation.CompareRevisionsFromFileHistoryActionProvider.description.show.diff=Show diff with previous version
|
||||
vcs.log.action.intellisort.title=IntelliSort: {0}
|
||||
vcs.log.action.intellisort.text=IntelliSort
|
||||
vcs.log.action.intellisort.description=Turn IntelliSort On/Off
|
||||
vcs.log.action.turn.intellisort.on=Turn IntelliSort on: {0}.
|
||||
vcs.log.action.turn.intellisort.off=Turn IntelliSort off: {0}.
|
||||
action.Vcs.Log.GoToRef.text=Go To Hash/Branch/Tag
|
||||
action.Vcs.Log.GoToRef.description=Specify hash or name of a branch or a tag to navigate to the commit it points
|
||||
action.Vcs.Log.GoToParent.text=Go to Parent Commit
|
||||
@@ -303,13 +299,13 @@ vcs.log.column.author=Author
|
||||
vcs.log.column.date=Date
|
||||
vcs.log.column.hash=Hash
|
||||
|
||||
# graph
|
||||
graph.sort.linear=Linear
|
||||
# graph sort
|
||||
graph.sort.linear=Linearize Merges
|
||||
graph.sort.linear.description=In case of merge show incoming commits on top of main branch commits as if they were rebased
|
||||
graph.sort.standard=Standard
|
||||
graph.sort.standard.description=In case of merge show incoming commits first (directly below merge commit)
|
||||
graph.sort.off=Off
|
||||
graph.sort.off.description=Sort commits topologically and by date
|
||||
graph.sort.standard=Prioritize Incoming Commits
|
||||
graph.sort.standard.description=In case of merge show incoming commits first, directly below merge commit
|
||||
graph.sort.off=By Commit Date
|
||||
graph.sort.off.description=Sort commits topologically and by commit date
|
||||
|
||||
# accessibility
|
||||
vcs.log.table.accessible.name={0} log
|
||||
|
||||
@@ -108,7 +108,6 @@
|
||||
<action class="com.intellij.vcs.log.ui.actions.GoToChildRowAction" id="Vcs.Log.GoToChild">
|
||||
<keyboard-shortcut first-keystroke="LEFT" keymap="$default"/>
|
||||
</action>
|
||||
<action class="com.intellij.vcs.log.ui.actions.IntelliSortChooserToggleAction" id="Vcs.Log.IntelliSortChooser"/>
|
||||
<action class="com.intellij.vcs.log.ui.actions.VcsShowLogAction" id="Vcs.Show.Log" icon="AllIcons.Toolwindows.ToolWindowChanges">
|
||||
<add-to-group group-id="Vcs.Show.Toolwindow.Tab"/>
|
||||
</action>
|
||||
@@ -162,6 +161,9 @@
|
||||
</action>
|
||||
</group>
|
||||
|
||||
<group id="Vcs.Log.SortTypeGroup" class="com.intellij.vcs.log.ui.actions.VcsLogSortTypeChooserGroup" popup="false"
|
||||
icon="VcsLogIcons.IntelliSort"/>
|
||||
|
||||
<group id="Vcs.Log.PresentationSettings" class="com.intellij.vcs.log.ui.actions.VcsLogToolbarPopupActionGroup"
|
||||
icon="AllIcons.Actions.GroupBy" popup="true">
|
||||
<separator key="action.vcs.log.show.separator"/>
|
||||
@@ -174,9 +176,9 @@
|
||||
<reference id="Vcs.Log.ToggleColumns"/>
|
||||
<separator/>
|
||||
<reference id="Vcs.Log.HighlightersActionGroup"/>
|
||||
<separator/>
|
||||
<separator key="action.vcs.log.sort.type.separator"/>
|
||||
<reference ref="Vcs.Log.SortTypeGroup"/>
|
||||
<separator key="action.vcs.log.branches.separator"/>
|
||||
<reference ref="Vcs.Log.IntelliSortChooser"/>
|
||||
<reference id="Vcs.Log.CollapseAll"/>
|
||||
<reference id="Vcs.Log.ExpandAll"/>
|
||||
</group>
|
||||
|
||||
@@ -8,7 +8,6 @@ public final @NonNls class VcsLogActionIds {
|
||||
public static final String POPUP_ACTION_GROUP = "Vcs.Log.ContextMenu";
|
||||
public static final String TOOLBAR_ACTION_GROUP = "Vcs.Log.Toolbar.Internal";
|
||||
public static final String TOOLBAR_RIGHT_CORNER_ACTION_GROUP = "Vcs.Log.Toolbar.RightCorner";
|
||||
public static final String PRESENTATION_SETTINGS_ACTION_GROUP = "Vcs.Log.PresentationSettings";
|
||||
public static final String TEXT_FILTER_SETTINGS_ACTION_GROUP = "Vcs.Log.TextFilterSettings";
|
||||
public static final String FILE_HISTORY_TOOLBAR_ACTION_GROUP = "Vcs.FileHistory.Toolbar";
|
||||
public static final String FILE_HISTORY_TOOLBAR_RIGHT_CORNER_ACTION_GROUP = "Vcs.FileHistory.Toolbar.RightCorner";
|
||||
@@ -17,7 +16,6 @@ public final @NonNls class VcsLogActionIds {
|
||||
public static final String CHANGES_BROWSER_TOOLBAR_ACTION_GROUP = "Vcs.Log.ChangesBrowser.Toolbar";
|
||||
|
||||
// action ids
|
||||
public static final String VCS_LOG_INTELLI_SORT_ACTION = "Vcs.Log.IntelliSortChooser";
|
||||
public static final String VCS_LOG_FOCUS_TEXT_FILTER = "Vcs.Log.FocusTextFilter";
|
||||
public static final String VCS_LOG_SHOW_DIFF_ACTION = "Diff.ShowDiff";
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.vcs.log.ui.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.vcs.log.VcsLogBundle;
|
||||
import com.intellij.vcs.log.VcsLogDataKeys;
|
||||
import com.intellij.vcs.log.VcsLogUi;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
|
||||
import com.intellij.vcs.log.impl.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
|
||||
import com.intellij.vcs.log.util.BekUtil;
|
||||
import com.intellij.vcs.log.util.GraphSortPresentationUtil;
|
||||
import icons.VcsLogIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IntelliSortChooserToggleAction extends ToggleAction implements DumbAware {
|
||||
|
||||
public IntelliSortChooserToggleAction() {
|
||||
//noinspection DialogTitleCapitalization
|
||||
super(VcsLogBundle.message("vcs.log.action.intellisort.text"),
|
||||
VcsLogBundle.message("vcs.log.action.intellisort.description"),
|
||||
VcsLogIcons.IntelliSort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(@NotNull AnActionEvent e) {
|
||||
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
|
||||
return properties != null &&
|
||||
properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE) &&
|
||||
!properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE).equals(PermanentGraph.SortType.Normal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(@NotNull AnActionEvent e, boolean state) {
|
||||
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
|
||||
if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
|
||||
PermanentGraph.SortType bekSortType = state ? PermanentGraph.SortType.Bek : PermanentGraph.SortType.Normal;
|
||||
properties.set(MainVcsLogUiProperties.BEK_SORT_TYPE, bekSortType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
super.update(e);
|
||||
|
||||
VcsLogUi logUI = e.getData(VcsLogDataKeys.VCS_LOG_UI);
|
||||
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
|
||||
Presentation presentation = e.getPresentation();
|
||||
presentation.setVisible(BekUtil.isBekEnabled());
|
||||
presentation.setEnabled(BekUtil.isBekEnabled() && logUI != null);
|
||||
|
||||
if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
|
||||
String description;
|
||||
if (properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.Normal) {
|
||||
String localizedDescription = GraphSortPresentationUtil.getLocalizedDescription(PermanentGraph.SortType.Bek);
|
||||
description = VcsLogBundle.message("vcs.log.action.turn.intellisort.on", StringUtil.toLowerCase(localizedDescription));
|
||||
}
|
||||
else {
|
||||
String localizedDescription = GraphSortPresentationUtil.getLocalizedDescription(PermanentGraph.SortType.Normal);
|
||||
description = VcsLogBundle.message("vcs.log.action.turn.intellisort.off", StringUtil.toLowerCase(localizedDescription));
|
||||
}
|
||||
presentation.setDescription(description);
|
||||
}
|
||||
else {
|
||||
//noinspection DialogTitleCapitalization
|
||||
presentation.setDescription(VcsLogBundle.message("vcs.log.action.intellisort.description"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ActionUpdateThread getActionUpdateThread() {
|
||||
return ActionUpdateThread.EDT;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +1,47 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.vcs.log.ui.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.vcs.log.VcsLogBundle;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.VcsLogDataKeys;
|
||||
import com.intellij.vcs.log.VcsLogUi;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
|
||||
import com.intellij.vcs.log.impl.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
|
||||
import com.intellij.vcs.log.util.BekUtil;
|
||||
import com.intellij.vcs.log.util.GraphSortPresentationUtil;
|
||||
import icons.VcsLogIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IntelliSortChooserPopupAction extends DefaultActionGroup {
|
||||
public IntelliSortChooserPopupAction() {
|
||||
super(VcsLogBundle.messagePointer("action.IntelliSortChooserPopupAction.text"),
|
||||
VcsLogBundle.messagePointer("action.IntelliSortChooserPopupAction.description"), VcsLogIcons.IntelliSort);
|
||||
getTemplatePresentation().setPopupGroup(true);
|
||||
}
|
||||
public class VcsLogSortTypeChooserGroup extends DefaultActionGroup {
|
||||
|
||||
@Override
|
||||
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
|
||||
if (e == null) return EMPTY_ARRAY;
|
||||
|
||||
VcsLogUi logUI = e.getData(VcsLogDataKeys.VCS_LOG_UI);
|
||||
if (logUI == null) return EMPTY_ARRAY;
|
||||
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
|
||||
if (properties == null) return EMPTY_ARRAY;
|
||||
|
||||
return Arrays.stream(PermanentGraph.SortType.values())
|
||||
.map(sortType -> new SelectIntelliSortTypeAction(logUI, properties, sortType))
|
||||
.toArray(AnAction[]::new);
|
||||
List<PermanentGraph.SortType> sortTypes = getAvailableSortTypes();
|
||||
|
||||
List<AnAction> actions = new ArrayList<>();
|
||||
actions.addAll(ContainerUtil.map(sortTypes, sortType -> {
|
||||
return new SelectSortTypeAction(logUI, properties, sortType);
|
||||
}));
|
||||
return actions.toArray(EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
|
||||
e.getPresentation().setEnabled(properties != null);
|
||||
if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
|
||||
String sortName = GraphSortPresentationUtil.getLocalizedName(properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE));
|
||||
String description = VcsLogBundle.message("vcs.log.action.intellisort.title", sortName);
|
||||
e.getPresentation().setDescription(description);
|
||||
e.getPresentation().setText(description);
|
||||
}
|
||||
e.getPresentation().setEnabled(properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,14 +49,25 @@ public class IntelliSortChooserPopupAction extends DefaultActionGroup {
|
||||
return ActionUpdateThread.EDT;
|
||||
}
|
||||
|
||||
private static class SelectIntelliSortTypeAction extends ToggleAction implements DumbAware {
|
||||
private static @NotNull List<PermanentGraph.SortType> getAvailableSortTypes() {
|
||||
List<PermanentGraph.SortType> sortTypes = new ArrayList<>(PermanentGraph.SortType.getEntries());
|
||||
if (!BekUtil.isBekEnabled()) {
|
||||
sortTypes.remove(PermanentGraph.SortType.Bek);
|
||||
}
|
||||
else if (!BekUtil.isLinearBekEnabled()) {
|
||||
sortTypes.remove(PermanentGraph.SortType.LinearBek);
|
||||
}
|
||||
return sortTypes;
|
||||
}
|
||||
|
||||
private static class SelectSortTypeAction extends ToggleAction implements DumbAware {
|
||||
private final PermanentGraph.SortType mySortType;
|
||||
private final VcsLogUi myUI;
|
||||
private final VcsLogUiProperties myProperties;
|
||||
|
||||
SelectIntelliSortTypeAction(@NotNull VcsLogUi ui,
|
||||
@NotNull VcsLogUiProperties properties,
|
||||
@NotNull PermanentGraph.SortType sortType) {
|
||||
SelectSortTypeAction(@NotNull VcsLogUi ui,
|
||||
@NotNull VcsLogUiProperties properties,
|
||||
@NotNull PermanentGraph.SortType sortType) {
|
||||
super(() -> GraphSortPresentationUtil.getLocalizedName(sortType),
|
||||
() -> GraphSortPresentationUtil.getLocalizedDescription(sortType) + ".",
|
||||
null);
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.vcs.log.ui.frame;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
@@ -43,14 +43,12 @@ import com.intellij.vcs.log.ui.AbstractVcsLogUi;
|
||||
import com.intellij.vcs.log.ui.VcsLogActionIds;
|
||||
import com.intellij.vcs.log.ui.VcsLogColorManager;
|
||||
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
|
||||
import com.intellij.vcs.log.ui.actions.IntelliSortChooserPopupAction;
|
||||
import com.intellij.vcs.log.ui.details.CommitDetailsListPanel;
|
||||
import com.intellij.vcs.log.ui.details.commit.CommitDetailsPanel;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogFilterUiEx;
|
||||
import com.intellij.vcs.log.ui.table.CommitSelectionListener;
|
||||
import com.intellij.vcs.log.ui.table.IndexSpeedSearch;
|
||||
import com.intellij.vcs.log.ui.table.VcsLogGraphTable;
|
||||
import com.intellij.vcs.log.util.BekUtil;
|
||||
import com.intellij.vcs.log.util.VcsLogUiUtil;
|
||||
import com.intellij.vcs.log.util.VcsLogUtil;
|
||||
import com.intellij.vcs.log.visible.VisiblePack;
|
||||
@@ -233,9 +231,6 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
String vcsDisplayName = VcsLogUtil.getVcsDisplayName(myLogData.getProject(), myLogData.getLogProviders().values());
|
||||
textFilter.getAccessibleContext().setAccessibleName(VcsLogBundle.message("vcs.log.text.filter.accessible.name", vcsDisplayName));
|
||||
|
||||
DefaultActionGroup presentationSettingsGroup = (DefaultActionGroup)actionManager.getAction(VcsLogActionIds.PRESENTATION_SETTINGS_ACTION_GROUP);
|
||||
configureIntelliSortAction(presentationSettingsGroup);
|
||||
|
||||
ActionGroup rightCornerGroup = (ActionGroup)Objects.requireNonNull(CustomActionsSchema.getInstance().getCorrectedAction(VcsLogActionIds.TOOLBAR_RIGHT_CORNER_ACTION_GROUP));
|
||||
ActionToolbar rightCornerToolbar = actionManager.createActionToolbar(ActionPlaces.VCS_LOG_TOOLBAR_PLACE, rightCornerGroup, true);
|
||||
rightCornerToolbar.setTargetComponent(this);
|
||||
@@ -249,19 +244,6 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
return panel;
|
||||
}
|
||||
|
||||
private static void configureIntelliSortAction(@NotNull DefaultActionGroup group) {
|
||||
AnAction intelliSortAction = ActionManager.getInstance().getAction(VcsLogActionIds.VCS_LOG_INTELLI_SORT_ACTION);
|
||||
if (BekUtil.isBekEnabled()) {
|
||||
if (BekUtil.isLinearBekEnabled()) {
|
||||
group.replaceAction(intelliSortAction, new IntelliSortChooserPopupAction());
|
||||
}
|
||||
}
|
||||
else {
|
||||
// drop together with com.intellij.vcs.log.util.BekUtil.isBekEnabled
|
||||
group.remove(intelliSortAction);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getData(@NotNull @NonNls String dataId) {
|
||||
if (VcsDataKeys.CHANGES.is(dataId) || VcsDataKeys.SELECTED_CHANGES.is(dataId)) {
|
||||
|
||||
Reference in New Issue
Block a user