diff --git a/platform/ide-core/resources/messages/ApplicationBundle.properties b/platform/ide-core/resources/messages/ApplicationBundle.properties index 9b5890f2b3ce..f9d7e5fddce5 100644 --- a/platform/ide-core/resources/messages/ApplicationBundle.properties +++ b/platform/ide-core/resources/messages/ApplicationBundle.properties @@ -954,5 +954,7 @@ settings.editor.general.appearance=Open settings settings.editor.sticky.lines.disabled.title=Sticky lines disabled settings.editor.sticky.lines.disabled.text=Enable sticky lines in settings +advanced.setting.project.view.show.scratches.and.consoles=Enable Scratches and Consoles in the Project view + title.inline.completion=Inline Completion text.go.to.inline.completion.settings=Go to Inline Completion settings page to adjust inline completion (e.g. Full Line Code Completion) settings diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index ac576458f0bb..fbff28061550 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -98,6 +98,7 @@ import java.util.function.Function; import java.util.function.Supplier; import static com.intellij.application.options.OptionId.PROJECT_VIEW_SHOW_VISIBILITY_ICONS; +import static com.intellij.ide.scratch.ScratchTreeStructureProvider.SCRATCHES_NODE_SETTING; import static com.intellij.ui.treeStructure.Tree.AUTO_SCROLL_FROM_SOURCE_BLOCKED; @State(name = "ProjectView", storages = @Storage(StoragePathMacros.PRODUCT_WORKSPACE_FILE), getStateRequiresEdt = true) @@ -322,7 +323,8 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo private final Option myShowScratchesAndConsoles = new Option() { @Override public boolean isEnabled(@NotNull AbstractProjectViewPane pane) { - return pane.supportsShowScratchesAndConsoles(); + return AdvancedSettings.getBoolean(SCRATCHES_NODE_SETTING) && + pane.supportsShowScratchesAndConsoles(); } @Override diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchTreeStructureProvider.java b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchTreeStructureProvider.java index bf50ce3512bd..6f63548051ef 100644 --- a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchTreeStructureProvider.java +++ b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchTreeStructureProvider.java @@ -18,6 +18,8 @@ import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.extensions.ExtensionPointListener; import com.intellij.openapi.extensions.PluginDescriptor; import com.intellij.openapi.fileTypes.LanguageFileType; +import com.intellij.openapi.options.advanced.AdvancedSettings; +import com.intellij.openapi.options.advanced.AdvancedSettingsChangeListener; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; @@ -38,6 +40,7 @@ import com.intellij.psi.search.PsiElementProcessor; import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.JBIterable; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -50,6 +53,9 @@ import java.util.concurrent.ConcurrentMap; */ public final class ScratchTreeStructureProvider implements TreeStructureProvider, DumbAware { + @ApiStatus.Internal + public static final String SCRATCHES_NODE_SETTING = "project.view.show.scratches.and.consoles"; + public ScratchTreeStructureProvider(Project project) { registerUpdaters(project, project, new Runnable() { AbstractProjectViewPane updateTarget; @@ -62,6 +68,15 @@ public final class ScratchTreeStructureProvider implements TreeStructureProvider if (updateTarget != null) updateTarget.updateFromRoot(true); } }); + ApplicationManager.getApplication().getMessageBus() + .connect(project).subscribe(AdvancedSettingsChangeListener.TOPIC, new AdvancedSettingsChangeListener() { + @Override + public void advancedSettingChanged(@NotNull String id, @NotNull Object oldValue, @NotNull Object newValue) { + if (SCRATCHES_NODE_SETTING.equals(id)) { + ProjectView.getInstance(project).refresh(); + } + } + }); } private static void registerUpdaters(@NotNull Project project, @NotNull Disposable disposable, @NotNull Runnable onUpdate) { @@ -174,7 +189,9 @@ public final class ScratchTreeStructureProvider implements TreeStructureProvider } List> list = new ArrayList<>(children.size() + 1); list.addAll(children); - list.add(new MyProjectNode(project, settings)); + if (AdvancedSettings.getBoolean(SCRATCHES_NODE_SETTING)) { + list.add(new MyProjectNode(project, settings)); + } return list; } diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 63d26f0368c4..e34a39bd71b8 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -385,6 +385,8 @@ + +