debugger ui experiment - fixed other places using registry directly

GitOrigin-RevId: 491dd3952b2f9397a25d868d1678b07a8e980f23
This commit is contained in:
Egor Ushakov
2022-05-30 17:22:08 +02:00
committed by intellij-monorepo-bot
parent 46b1ea56d9
commit 32d39ad93f
14 changed files with 58 additions and 37 deletions

View File

@@ -26,6 +26,7 @@ import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.ui.ExecutionConsole;
import com.intellij.execution.ui.ExecutionConsoleEx;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.extensions.ExtensionPointListener;
@@ -417,7 +418,7 @@ public class JavaDebugProcess extends XDebugProcess {
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar,
@NotNull DefaultActionGroup topToolbar,
@NotNull DefaultActionGroup settings) {
if (!Registry.is("debugger.new.tool.window.layout")) {
if (!UIExperiment.isNewDebuggerUIEnabled()) {
Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
leftToolbar.add(Separator.getInstance(), beforeRunner);
leftToolbar.add(ActionManager.getInstance().getAction("DumpThreads"), beforeRunner);

View File

@@ -4,6 +4,7 @@ package com.intellij.java.ift.lesson.essential
import com.intellij.codeInsight.daemon.impl.analysis.HighlightingFeature
import com.intellij.execution.ExecutionBundle
import com.intellij.execution.RunManager
import com.intellij.execution.ui.UIExperiment
import com.intellij.icons.AllIcons
import com.intellij.ide.DataManager
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereManagerImpl
@@ -39,7 +40,6 @@ import com.intellij.openapi.ui.ex.MultiLineLabel
import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.util.NlsSafe
import com.intellij.openapi.util.WindowStateService
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.openapi.wm.impl.FocusManagerImpl
import com.intellij.toolWindow.StripeButton
@@ -333,7 +333,7 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
rehighlightPreviousUi = true
text(JavaLessonsBundle.message("java.onboarding.balloon.about.debug.panel",
strong(UIBundle.message("tool.window.name.debug")),
if (Registry.`is`("debugger.new.tool.window.layout")) 0 else 1,
if (UIExperiment.isNewDebuggerUIEnabled()) 0 else 1,
strong(LessonsBundle.message("debug.workflow.lesson.name"))))
proceedLink()
restoreIfModified(sample)

View File

@@ -1,16 +1,16 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diagnostic.logging;
import com.intellij.execution.configurations.RunConfigurationBase;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentWithActions;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManagerEvent;
@@ -40,7 +40,7 @@ public abstract class LogConsoleManagerBase implements LogConsoleManager, Dispos
@NotNull Charset charset,
final long skippedContent,
@NotNull RunConfigurationBase runConfiguration) {
boolean useBuildInActions = Registry.is("debugger.new.tool.window.layout", false);
boolean useBuildInActions = UIExperiment.isNewDebuggerUIEnabled();
doAddLogConsole(new LogConsoleImpl(myProject, new File(path), charset, skippedContent, name, useBuildInActions, mySearchScope) {
@Override
public boolean isActive() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.runners;
import com.intellij.CommonBundle;
@@ -93,7 +93,7 @@ public final class RunContentBuilder extends RunTab {
consoleContent.setActions(new DefaultActionGroup(), ActionPlaces.RUNNER_TOOLBAR, console.getComponent());
}
ActionGroup toolbar = createActionToolbar(contentDescriptor, consoleActionsToMerge);
if (Registry.is("debugger.new.tool.window.layout")) {
if (UIExperiment.isNewDebuggerUIEnabled()) {
var isVerticalToolbar = Registry.get("debugger.new.tool.window.layout.toolbar").isOptionEnabled("Vertical");
mySupplier = new RunTabSupplier(toolbar) {
@@ -194,7 +194,7 @@ public final class RunContentBuilder extends RunTab {
@NotNull
private ActionGroup createActionToolbar(@NotNull RunContentDescriptor contentDescriptor, AnAction @NotNull [] consoleActions) {
boolean isNewLayout = Registry.is("debugger.new.tool.window.layout");
boolean isNewLayout = UIExperiment.isNewDebuggerUIEnabled();
final DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));

View File

@@ -0,0 +1,18 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.ui;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.ApiStatus;
@ApiStatus.Internal
public class UIExperiment {
private static boolean NEW_DEBUGGER_UI_ENABLED = false;
public static boolean isNewDebuggerUIEnabled() {
return Registry.is("debugger.new.tool.window.layout", false) || NEW_DEBUGGER_UI_ENABLED;
}
public static void setNewDebuggerUIEnabled(boolean state) {
NEW_DEBUGGER_UI_ENABLED = state;
}
}

View File

@@ -5,6 +5,7 @@ import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunContentManager;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.execution.ui.layout.*;
import com.intellij.execution.ui.layout.actions.*;
import com.intellij.icons.AllIcons;
@@ -24,7 +25,6 @@ import com.intellij.openapi.ui.ThreeComponentsSplitter;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.Strings;
import com.intellij.openapi.wm.*;
import com.intellij.openapi.wm.ex.ToolWindowEx;
@@ -339,7 +339,7 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
dockManager.register(this, this);
}
}
if (Registry.is("debugger.new.tool.window.layout")) {
if (UIExperiment.isNewDebuggerUIEnabled()) {
MouseAdapter adapter = new MouseAdapter() {
private Point myPressPoint = null;
@@ -1080,7 +1080,7 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
ActionToolbar tb = myActionManager.createActionToolbar(place, group, true);
tb.setReservePlaceAutoPopupIcon(false);
// see IDEA-262878, evaluate action on the toolbar should get the editor data context
tb.setTargetComponent(Registry.is("debugger.new.tool.window.layout") ? myComponent : null);
tb.setTargetComponent(UIExperiment.isNewDebuggerUIEnabled() ? myComponent : null);
tb.getComponent().setBorder(null);
tb.getComponent().setOpaque(false);
@@ -1091,7 +1091,7 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) {
Wrapper eachPlaceholder = entry.getValue();
ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.RUNNER_LAYOUT_BUTTON_TOOLBAR, myViewActions, true);
tb.setSecondaryActionsIcon(AllIcons.Debugger.RestoreLayout, Registry.is("debugger.new.tool.window.layout"));
tb.setSecondaryActionsIcon(AllIcons.Debugger.RestoreLayout, UIExperiment.isNewDebuggerUIEnabled());
tb.setSecondaryActionsTooltip(ExecutionBundle.message("runner.content.tooltip.layout.settings"));
tb.setTargetComponent(myComponent);
tb.getComponent().setOpaque(false);
@@ -1605,7 +1605,7 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (!Registry.is("debugger.new.tool.window.layout")) return;
if (!UIExperiment.isNewDebuggerUIEnabled()) return;
InternalDecoratorImpl decorator = ComponentUtil.getParentOfType(InternalDecoratorImpl.class, myComponent);
if (decorator != null && myTabs.getTabCount() > 0 && !decorator.isHeaderVisible()) {
UIUtil.drawHeader(g, 0, getWidth(), decorator.getHeaderHeight(), decorator.isActive(), true, false, false);
@@ -1868,7 +1868,7 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
AnAction[] kids = myLeftToolbarActions.getChildren(null);
ContainerUtil.addAll(result, kids);
}
if (myTopLeftActions != null && Registry.is("debugger.new.tool.window.layout")) {
if (myTopLeftActions != null && UIExperiment.isNewDebuggerUIEnabled()) {
AnAction[] kids = myTopLeftActions.getChildren(null);
ContainerUtil.addAll(result, kids);
}

View File

@@ -14,10 +14,7 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.services.ServiceEventListener;
import com.intellij.execution.services.ServiceViewManager;
import com.intellij.execution.services.ServiceViewManagerImpl;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunContentManager;
import com.intellij.execution.ui.RunContentManagerImpl;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.*;
import com.intellij.execution.ui.layout.impl.RunnerLayoutUiImpl;
import com.intellij.icons.AllIcons;
import com.intellij.ide.lightEdit.LightEdit;
@@ -33,7 +30,6 @@ import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.ui.content.*;
import com.intellij.util.SmartList;
@@ -562,7 +558,7 @@ public final class RunDashboardManagerImpl implements RunDashboardManager, Persi
RunContentDescriptor descriptor = RunContentManagerImpl.getRunContentDescriptorByContent(content);
RunnerLayoutUiImpl ui = getRunnerLayoutUi(descriptor);
if (ui != null) {
if (Registry.is("debugger.new.tool.window.layout")) {
if (UIExperiment.isNewDebuggerUIEnabled()) {
ui.setTopLeftActionsVisible(visible);
}
else {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework;
@@ -13,6 +13,7 @@ import com.intellij.execution.testframework.actions.TestTreeExpander;
import com.intellij.execution.testframework.autotest.AdjustAutotestDelayActionGroup;
import com.intellij.execution.testframework.export.ExportTestResultsAction;
import com.intellij.execution.testframework.ui.AbstractTestTreeBuilderBase;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.icons.AllIcons;
import com.intellij.ide.CommonActionsManager;
import com.intellij.ide.OccurenceNavigator;
@@ -21,7 +22,6 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.impl.MoreActionGroup;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.config.DumbAwareToggleBooleanProperty;
import com.intellij.util.config.DumbAwareToggleInvertedBooleanProperty;
import com.intellij.util.config.ToggleBooleanProperty;
@@ -53,7 +53,7 @@ public class ToolbarPanel extends JPanel implements OccurenceNavigator, Disposab
properties, TestConsoleProperties.HIDE_IGNORED_TEST));
actionGroup.addSeparator();
boolean isNewLayout = Registry.is("debugger.new.tool.window.layout");
boolean isNewLayout = UIExperiment.isNewDebuggerUIEnabled();
var sortGroup = !isNewLayout ? actionGroup : DefaultActionGroup.createPopupGroup(() -> ExecutionBundle.message("junit.runing.info.sort.group.name"));
DumbAwareToggleBooleanProperty suitesAlwaysOnTop =

View File

@@ -577,6 +577,7 @@ debugger.new.debug.tool.window.view=false
debugger.new.debug.tool.window.view.description=Enable headerless mode for debugger tool window or (if new debugger UI is enabled) add an option to change thread view
debugger.ui.experiment.enabled=true
debugger.ui.experiment.group=-1
debugger.ui.experiment.group.restartRequired=true
debugger.ui.experiment.group.description=Defines the experiment group number. Negative value will be ignored.
debugger.track.instrumentation=true
debugger.variablesView.rss=true

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.xdebugger.impl.frame;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.dnd.DnDEvent;
@@ -193,7 +194,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
}
private @Nullable JComponent createTopPanel() {
//if (Registry.is("debugger.new.tool.window.layout")) {
//if (UIExperiment.isNewDebuggerUIEnabled()) {
XDebuggerTree tree = getTree();
Ref<AnAction> addToWatchesActionRef = new Ref<>();
XDebuggerEditorsProvider provider = tree.getEditorsProvider();
@@ -296,7 +297,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
JComponent component = myEvaluateComboBox.getComponent();
//component.setBackground(tree.getBackground());
component.setBorder(JBUI.Borders.customLine(JBColor.border(), 0, 0, 1, 0));
if (!Registry.is("debugger.new.tool.window.layout")) {
if (!UIExperiment.isNewDebuggerUIEnabled()) {
XToggleEvaluateExpressionFieldAction.markAsEvaluateExpressionField(component);
}
return component;

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.xdebugger.impl.ui
import com.intellij.execution.ui.UIExperiment
import com.intellij.internal.statistic.eventLog.EventLogConfiguration.Companion.getInstance
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.eventLog.events.EventFields
@@ -21,12 +22,14 @@ class DebuggerUIExperimentCollector : CounterUsagesCollector() {
@JvmStatic
fun startExperiment(): Boolean {
if (!isEnabled()) {
return false
var res = false
if (isEnabled()) {
val experimentGroup = getExperimentGroup()
START.log(experimentGroup)
res = experimentGroup == NUMBER_OF_EXPERIMENT_GROUPS - 1
}
val experimentGroup = getExperimentGroup()
START.log(experimentGroup)
return experimentGroup == NUMBER_OF_EXPERIMENT_GROUPS - 1
UIExperiment.setNewDebuggerUIEnabled(res)
return res
}
@JvmStatic

View File

@@ -1,8 +1,8 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.xdebugger.impl.ui;
import com.intellij.execution.ui.UIExperiment;
import com.intellij.ide.ui.customization.CustomizableActionGroupProvider;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
@@ -12,7 +12,7 @@ public class XDebugTabCustomizableActionGroupProvider extends CustomizableAction
registrar.addCustomizableActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP, XDebuggerBundle.message("debug.tool.window.top.toolbar"));
registrar.addCustomizableActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP, XDebuggerBundle.message("debug.tool.window.left.toolbar"));
registrar.addCustomizableActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP, XDebuggerBundle.message("debug.watches.toolbar"));
if (Registry.is("debugger.new.tool.window.layout", false)) {
if (UIExperiment.isNewDebuggerUIEnabled()) {
registrar.addCustomizableActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_3_GROUP, XDebuggerBundle.message("debug.tool.window.header.toolbar"));
registrar.addCustomizableActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_3_EXTRA_GROUP, XDebuggerBundle.message("debug.tool.window.more.toolbar"));
}

View File

@@ -4,6 +4,7 @@ package training.dsl
import com.intellij.codeInsight.documentation.DocumentationComponent
import com.intellij.codeInsight.documentation.DocumentationEditorPane
import com.intellij.codeInsight.documentation.QuickDocUtil.isDocumentationV2Enabled
import com.intellij.execution.ui.UIExperiment
import com.intellij.execution.ui.layout.impl.RunnerLayoutSettings
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.CommonDataKeys
@@ -423,7 +424,7 @@ fun LessonContext.highlightDebugActionsToolbar() {
}
task {
if (!Registry.`is`("debugger.new.tool.window.layout")) {
if (!UIExperiment.isNewDebuggerUIEnabled()) {
highlightToolbarWithAction(ActionPlaces.DEBUGGER_TOOLBAR, "ShowExecutionPoint", clearPreviousHighlights = false)
}
}

View File

@@ -4,6 +4,7 @@ package com.jetbrains.python.ift.lesson.essensial
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.execution.ExecutionBundle
import com.intellij.execution.RunManager
import com.intellij.execution.ui.UIExperiment
import com.intellij.icons.AllIcons
import com.intellij.ide.DataManager
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereManagerImpl
@@ -26,7 +27,6 @@ import com.intellij.openapi.ui.MessageDialogBuilder
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.util.WindowStateService
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.openapi.wm.impl.FocusManagerImpl
import com.intellij.openapi.wm.impl.status.TextPanel
@@ -247,7 +247,7 @@ class PythonOnboardingTourLesson :
rehighlightPreviousUi = true
text(PythonLessonsBundle.message("python.onboarding.balloon.about.debug.panel",
strong(UIBundle.message("tool.window.name.debug")),
if (Registry.`is`("debugger.new.tool.window.layout")) 0 else 1,
if (UIExperiment.isNewDebuggerUIEnabled()) 0 else 1,
strong(LessonsBundle.message("debug.workflow.lesson.name"))))
proceedLink()
restoreIfModified(sample)