From 17729d6db5fca23ee316b7854a09120a0b6f4edf Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 5 Apr 2017 21:16:45 +0300 Subject: [PATCH] IDEA-169924 show/hide breadcrumbs from a gutter popup --- .../ToggleShowBreadcrumbsGloballyAction.java | 35 +++++++++++++++++++ .../src/messages/ActionsBundle.properties | 1 + .../src/idea/PlatformActions.xml | 1 + .../BreadcrumbsInitializingActivity.java | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowBreadcrumbsGloballyAction.java diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowBreadcrumbsGloballyAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowBreadcrumbsGloballyAction.java new file mode 100644 index 000000000000..4d610f8250bc --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowBreadcrumbsGloballyAction.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.editor.actions; + +import com.intellij.ide.ui.UISettings; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.ToggleAction; +import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; +import com.intellij.openapi.project.DumbAware; + +public class ToggleShowBreadcrumbsGloballyAction extends ToggleAction implements DumbAware { + @Override + public boolean isSelected(AnActionEvent event) { + return EditorSettingsExternalizable.getInstance().isBreadcrumbsShown(); + } + + @Override + public void setSelected(AnActionEvent event, boolean selected) { + EditorSettingsExternalizable.getInstance().setBreadcrumbsShown(selected); + UISettings.getInstance().fireUISettingsChanged(); + } +} diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index a756aa3b39f0..cad70ba37325 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1499,6 +1499,7 @@ action.EditorGutterToggleGlobalSoftWraps.text=Soft-Wrap All Files action.EditorGutterToggleLocalSoftWraps.gutterText=Soft-Wrap Current File action.EditorGutterToggleGlobalLineNumbers.text=Show Line Numbers action.EditorGutterToggleGlobalIndentLines.text=Show Indent Guides +action.EditorGutterToggleGlobalBreadcrumbs.text=Show Breadcrumbs action.ExcludeFromProject.text=Exclude From Project... group.MarkFileAs.text=Mark File as action.MarkAsPlainTextAction.text=Mark as Plain Text diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 32f974feeb4e..8f6cde011eac 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -654,6 +654,7 @@ + diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java index 028510e05a35..4cf33566d78e 100644 --- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java +++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java @@ -86,7 +86,7 @@ public class BreadcrumbsInitializingActivity implements StartupActivity, DumbAwa } private static void reinitBreadcrumbsInAllEditors(@NotNull Project project) { - if (!project.isDisposed()) return; + if (project.isDisposed()) return; FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); for (VirtualFile virtualFile : fileEditorManager.getOpenFiles()) { reinitBreadcrumbsComponent(fileEditorManager, virtualFile);