From 84fca015eeb08d5d7bdd332fb398934a46e9a8e2 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 7 Feb 2013 14:29:14 +0400 Subject: [PATCH] [vcs] "Filter update info by scope" action fixes * Remember the filter state in the settings. * Let it show (but disable) even if filtering is turned off. * Set action description. --- .../src/com/intellij/openapi/vcs/VcsConfiguration.java | 1 + .../com/intellij/openapi/vcs/update/UpdateInfoTree.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index 216857da835c..a402abbf0d25 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -145,6 +145,7 @@ public final class VcsConfiguration implements PersistentStateComponent public String ACTIVE_VCS_NAME; public boolean UPDATE_GROUP_BY_PACKAGES = false; public boolean UPDATE_GROUP_BY_CHANGELIST = false; + public boolean UPDATE_FILTER_BY_SCOPE = false; public boolean SHOW_FILE_HISTORY_AS_TREE = false; public float FILE_HISTORY_SPLITTER_PROPORTION = 0.6f; private static final int MAX_STORED_MESSAGES = 25; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java index 369de0f53171..995af2527ae7 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java @@ -115,6 +115,8 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di myProject = project; myUpdatedFiles = updatedFiles; myRootName = rootName; + + myShowOnlyFilteredItems = VcsConfiguration.getInstance(myProject).UPDATE_FILTER_BY_SCOPE; myFileStatusManager = FileStatusManager.getInstance(myProject); myFileStatusManager.addFileStatusListener(myFileStatusListener); @@ -451,8 +453,7 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di private class FilterAction extends ToggleAction implements DumbAware { public FilterAction() { - super("Scope Filter"); - getTemplatePresentation().setIcon(AllIcons.General.Filter); + super("Scope Filter", VcsBundle.getString("settings.filter.update.project.info.by.scope"), AllIcons.General.Filter); } @Override @@ -463,13 +464,13 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di @Override public void setSelected(AnActionEvent e, boolean state) { myShowOnlyFilteredItems = state; + VcsConfiguration.getInstance(myProject).UPDATE_FILTER_BY_SCOPE = myShowOnlyFilteredItems; updateTreeModel(); } public void update(AnActionEvent e) { super.update(e); - e.getPresentation().setVisible(VcsConfiguration.getInstance(myProject).UPDATE_FILTER_SCOPE_NAME != null); - e.getPresentation().setEnabled(!myGroupByChangeList); + e.getPresentation().setEnabled(!myGroupByChangeList && VcsConfiguration.getInstance(myProject).UPDATE_FILTER_SCOPE_NAME != null); } } }