fix todo actions availability

This commit is contained in:
Kirill.Skrygan
2018-12-13 15:52:54 +01:00
parent e3b20b9cc5
commit e156f8b272
4 changed files with 40 additions and 31 deletions
@@ -249,21 +249,6 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
@NotNull
protected DefaultActionGroup createGroupByActionGroup() {
ActionManager actionManager = ActionManager.getInstance();
actionManager.getAction("TodoViewGroupByFlattenPackage").registerCustomShortcutSet(
new CustomShortcutSet(
KeyStroke.getKeyStroke(KeyEvent.VK_F, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
myTree);
actionManager.getAction("TodoViewGroupByShowModules").registerCustomShortcutSet(
new CustomShortcutSet(
KeyStroke.getKeyStroke(KeyEvent.VK_M, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
myTree);
actionManager.getAction("TodoViewGroupByShowPackages").registerCustomShortcutSet(
new CustomShortcutSet(
KeyStroke.getKeyStroke(KeyEvent.VK_P, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
myTree);
return (DefaultActionGroup) actionManager.getAction("TodoViewGroupByGroup");
}
@@ -673,6 +658,12 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
super(IdeBundle.message("action.group.by.packages"), null, PlatformIcons.GROUP_BY_PACKAGES);
}
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(e.getData(TODO_PANEL_DATA_KEY) != null);
super.update(e);
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
TodoPanel todoPanel = e.getData(TODO_PANEL_DATA_KEY);
@@ -694,6 +685,12 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
super(IdeBundle.message("action.group.by.modules"), null, AllIcons.Actions.GroupByModule);
}
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(e.getData(TODO_PANEL_DATA_KEY) != null);
super.update(e);
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
TodoPanel todoPanel = e.getData(TODO_PANEL_DATA_KEY);
@@ -720,7 +717,6 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
public void update(@NotNull AnActionEvent e) {
super.update(e);
TodoPanel todoPanel = e.getData(TODO_PANEL_DATA_KEY);
e.getPresentation().setEnabled(todoPanel != null && todoPanel.mySettings.arePackagesShown);
}
@@ -88,8 +88,8 @@
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.RearrangeCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.OptimizeOptionsCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.CodeAnalysisCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.TodoCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.CodeCleanupCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.TodoCheckinHandlerFactory" id="todo"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.CodeCleanupCheckinHandlerFactory" id="codeCleanup"/>
<completion.contributor language="TEXT" implementationClass="com.intellij.openapi.vcs.CommitCompletionContributor" id="commitCompletion"
order="first, before liveTemplates"/>
@@ -1193,9 +1193,17 @@
<group id="TodoViewGroupByGroup" class="com.intellij.ide.todo.TodoPanel$GroupByActionGroup">
<separator text="Group by"/>
<action class="com.intellij.ide.todo.TodoPanel$MyShowModulesAction" id="TodoViewGroupByShowModules"/>
<action class="com.intellij.ide.todo.TodoPanel$MyShowPackagesAction" id="TodoViewGroupByShowPackages"/>
<action class="com.intellij.ide.todo.TodoPanel$MyFlattenPackagesAction" id="TodoViewGroupByFlattenPackage"/>
<action class="com.intellij.ide.todo.TodoPanel$MyShowModulesAction" id="TodoViewGroupByShowModules">
<keyboard-shortcut first-keystroke="control M" keymap="$default" />
</action>
<action class="com.intellij.ide.todo.TodoPanel$MyShowPackagesAction" id="TodoViewGroupByShowPackages">
<keyboard-shortcut first-keystroke="control P" keymap="$default" />
</action>
<action class="com.intellij.ide.todo.TodoPanel$MyFlattenPackagesAction" id="TodoViewGroupByFlattenPackage">
<keyboard-shortcut first-keystroke="control F" keymap="$default" />
</action>
</group>
</actions>
@@ -47,9 +47,10 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control F5", "Refresh", "Rerun"},
{ "control D", "EditorDuplicate", "Diff.ShowDiff", "CompareTwoFiles", "SendEOF", "FileChooser.GotoDesktop"},
{ "control L", "FindNext", "Vcs.Log.FocusTextFilter"},
{ "control M", "EditorScrollToCenter", "Vcs.ShowMessageHistory"},
{ "control M", "EditorScrollToCenter", "Vcs.ShowMessageHistory", "TodoViewGroupByShowModules"},
{ "control F", "TodoViewGroupByFlattenPackage", "Find"},
{ "control N", "FileChooser.NewFolder", "GotoClass", "GotoChangedFile"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "ParameterInfo"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "ParameterInfo", "TodoViewGroupByShowPackages"},
{ "control R", "Replace", "org.jetbrains.plugins.ruby.rails.console.ReloadSources"},
{ "control SLASH", "CommentByLineComment", "Images.Editor.ActualSize", "UML.ActualSize"},
{ "control SPACE", "CodeCompletion", "ChangesView.SetDefault"},
@@ -118,6 +119,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "meta 1", "ActivateProjectToolWindow", "FileChooser.GotoHome", "DuplicatesForm.SendToLeft"},
{ "meta 2", "ActivateFavoritesToolWindow", "FileChooser.GotoProject", "DuplicatesForm.SendToRight"},
{ "meta 3", "ActivateFindToolWindow", "FileChooser.GotoModule"},
{ "meta M", "MinimizeCurrentWindow", "TodoViewGroupByShowModules"},
{ "meta N", "FileChooser.NewFolder", "Generate", "NewElement"},
{ "meta O", "GotoClass", "GotoChangedFile"},
{ "shift meta G", "ClassTemplateNavigation", "GoToClass", "FindPrevious"},
@@ -144,6 +146,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control TAB", "Switcher", "Diff.FocusOppositePane"},
{ "control N", "Generate", "NewElement"},
{ "shift control TAB", "Switcher", "Diff.FocusOppositePaneAndScroll"},
{ "meta M", "MinimizeCurrentWindow", "TodoViewGroupByShowModules"},
{ "meta 1", "ActivateProjectToolWindow", "FileChooser.GotoHome", "DuplicatesForm.SendToLeft"},
{ "meta 2", "ActivateFavoritesToolWindow", "FileChooser.GotoProject", "DuplicatesForm.SendToRight"},
{ "meta 3", "ActivateFindToolWindow", "FileChooser.GotoModule"},
@@ -159,9 +162,10 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control D", "$Delete", "Diff.ShowDiff", "CompareTwoFiles", "SendEOF", "FileChooser.GotoDesktop"},
{ "control K", "EditorCutLineEnd", "CheckinProject"},
{ "control L", "EditorScrollToCenter", "Vcs.Log.FocusTextFilter"},
{ "control M", "EditorEnter", "EditorChooseLookupItem", "NextTemplateVariable", "Console.Execute"},
{ "control M", "EditorEnter", "EditorChooseLookupItem", "NextTemplateVariable", "Console.Execute", "TodoViewGroupByShowModules"},
{ "control N", "EditorDown", "FileChooser.NewFolder"},
{ "control P", "ChangesView.GroupBy.Directory", "EditorUp", "FileChooser.TogglePathShowing"},
{ "control F", "EditorRight", "TodoViewGroupByFlattenPackage"},
{ "control P", "ChangesView.GroupBy.Directory", "EditorUp", "FileChooser.TogglePathShowing","TodoViewGroupByShowPackages"},
{ "control R", "org.jetbrains.plugins.ruby.rails.console.ReloadSources", "FindPrevious"},
{ "control SLASH", "$Undo", "Images.Editor.ActualSize", "UML.ActualSize"},
{ "control SPACE", "EditorToggleStickySelection", "ChangesView.SetDefault"},
@@ -187,7 +191,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control F1", "ExternalJavaDoc", "ShowErrorDescription"},
{ "control F10", "Android.HotswapChanges", "RunToCursor", "UpdateRunningApplication"},
{ "control N", "FileChooser.NewFolder", "Generate", },
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print", "TodoViewGroupByShowPackages"},
{ "control alt F", "ReformatCode", "IntroduceField", "ShowFilterPopup"},
{ "shift F12", "RestoreDefaultLayout", "FindUsagesInFile"},
{ "shift F2", "GotoPreviousError", "GotoDeclaration"},
@@ -226,9 +230,10 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control D", "EditorDeleteLine", "Diff.ShowDiff", "CompareTwoFiles", "SendEOF", "FileChooser.GotoDesktop"},
{ "control L", "Vcs.Log.FocusTextFilter", "GotoLine"},
{ "control N", "ShowPopupMenu", "FileChooser.NewFolder"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print", "TodoViewGroupByShowPackages"},
{ "control R", "RunToCursor", "org.jetbrains.plugins.ruby.rails.console.ReloadSources"},
{ "control U", "EvaluateExpression", "CommanderSwapPanels"},
{ "control F", "Replace", "TodoViewGroupByFlattenPackage"},
{ "control PAGE_DOWN", "Diff.NextChange", "NextTab"},
{ "control PAGE_UP", "Diff.PrevChange", "PreviousTab"},
{ "control F6", "Diff.NextChange", "NextTab"},
@@ -264,7 +269,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "control 3", "ActivateProjectToolWindow", "FileChooser.GotoModule"},
{ "control BACK_SPACE", "EditorDeleteToWordStart", "ToggleDockMode"},
{ "control DIVIDE", "CollapseRegionRecursively", "Images.Editor.ActualSize", "UML.ActualSize"},
{ "control M", "Vcs.ShowMessageHistory", "Move"},
{ "control M", "Vcs.ShowMessageHistory", "Move", "TodoViewGroupByShowModules"},
{ "control N", "NewElement", "FileChooser.NewFolder"},
{ "control R", "RenameElement", "org.jetbrains.plugins.ruby.rails.console.ReloadSources", "Git.Reword.Commit", "ShelvedChanges.Rename", "ChangesView.Rename"},
{ "control U", SECOND_STROKE, "CommanderSwapPanels"},
@@ -292,8 +297,8 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
"SearchEverywhere.CompleteCommand", "SearchEverywhere.NextTab"},
{ "control F6", "PreviousEditorTab", "PreviousTab", },
{ "control L", "Vcs.Log.FocusTextFilter", "EditorSelectLine"},
{ "control M", "Vcs.ShowMessageHistory", "OverrideMethods", },
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "FindInPath"},
{ "control M", "Vcs.ShowMessageHistory", "OverrideMethods", "TodoViewGroupByShowModules"},
{ "control P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "FindInPath", "TodoViewGroupByShowPackages"},
{ "shift control A", "SaveAll", "GotoAction"},
{ "shift control E", "RecentChangedFiles", "ExtractMethod"},
{ "shift control ENTER", "FindUsages", "Console.Jpa.GenerateSql"},
@@ -313,7 +318,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
{ "meta 3", "FileChooser.GotoModule", "GotoAction"},
{ "meta D", "EditorDeleteLine", "Diff.ShowDiff", "CompareTwoFiles", "SendEOF", "FileChooser.GotoDesktop"},
{ "meta I", "DatabaseView.PropertiesAction", "AutoIndentLines"},
{ "meta P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print"},
{ "meta P", "ChangesView.GroupBy.Directory", "FileChooser.TogglePathShowing", "Print", "TodoViewGroupByShowPackages"},
{ "meta R", "org.jetbrains.plugins.ruby.rails.console.ReloadSources", "RunToCursor"},
{ "meta U", "CommanderSwapPanels", "EvaluateExpression"},
{ "meta W", "CloseContent", "CloseActiveTab"},