[shelf]: IDEA-149652 fix text for option Show/Hide Already Unshelved: keep action text in Context menu and change it in the toolbar according to the state.

This commit is contained in:
Nadya Zabrodina
2015-12-22 18:34:53 +03:00
parent 7c254e9853
commit 81f005aba1
@@ -32,9 +32,10 @@ public class ShowHideRecycledAction extends ToggleAction implements DumbAware {
final Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(project != null);
if (project != null) {
presentation.setText(ShelveChangesManager.getInstance(project).isShowRecycled() ?
final boolean fromContextMenu = ShelvedChangesViewManager.SHELF_CONTEXT_MENU.equals(e.getPlace());
presentation.setText(ShelveChangesManager.getInstance(project).isShowRecycled() && !fromContextMenu ?
"Hide Already Unshelved" : "Show Already Unshelved");
presentation.setIcon(ShelvedChangesViewManager.SHELF_CONTEXT_MENU.equals(e.getPlace()) ? null : AllIcons.Nodes.DisabledPointcut);
presentation.setIcon(fromContextMenu ? null : AllIcons.Nodes.DisabledPointcut);
}
}