IDEA-231160 DfaAssist: UI option to turn it on or off

GitOrigin-RevId: 5b1eae4595dc5e39a37ae35dfb460e7f7d3db61a
This commit is contained in:
Tagir Valeev
2020-01-22 16:31:43 +07:00
committed by intellij-monorepo-bot
parent 0f9cdfb3a5
commit c66e62e4f0
6 changed files with 26 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
import com.intellij.debugger.memory.component.MemoryViewDebugProcessData;
import com.intellij.debugger.memory.ui.ClassesFilteredView;
import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.settings.ViewsGeneralSettings;
import com.intellij.debugger.ui.AlternativeSourceNotificationProvider;
import com.intellij.debugger.ui.DebuggerContentInfo;
import com.intellij.debugger.ui.breakpoints.Breakpoint;
@@ -184,7 +185,7 @@ public class JavaDebugProcess extends XDebugProcess {
if (Registry.is("debugger.show.values.between.lines") && session instanceof XDebugSessionImpl) {
((XDebugSessionImpl)session).getSessionData().putUserData(XDebuggerInlayUtil.HELPER_KEY, new JavaDebuggerInlayUtil.Helper());
}
if (Registry.is("debugger.show.values.from.dfa")) {
if (ViewsGeneralSettings.getInstance().USE_DFA_ASSIST) {
DfaAssist.installDfaAssist(myJavaSession);
}

View File

@@ -12,6 +12,7 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
import com.intellij.debugger.impl.*;
import com.intellij.debugger.jdi.StackFrameProxyImpl;
import com.intellij.debugger.settings.ViewsGeneralSettings;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
@@ -79,6 +80,10 @@ public class DfaAssist implements DebuggerContextListener {
@Override
public void changeEvent(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) {
if (!ViewsGeneralSettings.getInstance().USE_DFA_ASSIST) {
shutDown(newContext);
return;
}
if (event == DebuggerSession.Event.DETACHED || event == DebuggerSession.Event.DISPOSE) {
cleanUp();
}
@@ -254,14 +259,18 @@ public class DfaAssist implements DebuggerContextListener {
}
@Override
public void actionPerformed(@NotNull AnActionEvent evt) {
DebuggerSession session = myContext.getDebuggerSession();
if (session != null) {
session.getContextManager().removeListener(DfaAssist.this);
cleanUp();
}
shutDown(myContext);
}
}
private void shutDown(DebuggerContextImpl context) {
DebuggerSession session = context.getDebuggerSession();
if (session != null) {
session.getContextManager().removeListener(this);
cleanUp();
}
}
/**
* Install dataflow assistant to the specified debugging session
* @param javaSession JVM debugger session to install an assistant to

View File

@@ -31,6 +31,7 @@ import static java.awt.GridBagConstraints.*;
*/
public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private JCheckBox myCbAutoscroll;
private JCheckBox myCbDfaAssist;
private JCheckBox myCbShowSyntheticFields;
private StateRestoringCheckBox myCbShowValFieldsAsLocalVariables;
private JCheckBox myCbHideNullArrayElements;
@@ -78,6 +79,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
final JPanel panel = new JPanel(new GridBagLayout());
myCbAutoscroll = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.autoscroll"));
myCbDfaAssist = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.dfa.assist"));
myCbShowSyntheticFields = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.synthetic.fields"));
myCbShowValFieldsAsLocalVariables = new StateRestoringCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.val.fields.as.locals"));
myCbHideNullArrayElements = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.hide.null.array.elements"));
@@ -137,6 +139,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
});
panel.add(myCbAutoscroll, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insetsTop(4), 0, 0));
panel.add(myCbDfaAssist, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insetsTop(4), 0, 0));
final JPanel showPanel = new JPanel(new GridBagLayout());
@@ -181,6 +184,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
generalSettings.AUTOSCROLL_TO_NEW_LOCALS = myCbAutoscroll.isSelected();
generalSettings.USE_DFA_ASSIST = myCbDfaAssist.isSelected();
rendererSettings.setAlternateCollectionViewsEnabled(myCbEnableAlternateViews.isSelected());
generalSettings.HIDE_NULL_ARRAY_ELEMENTS = myCbHideNullArrayElements.isSelected();
generalSettings.POPULATE_THROWABLE_STACKTRACE = myCbPopulateThrowableStack.isSelected();
@@ -212,6 +216,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
myCbAutoscroll.setSelected(generalSettings.AUTOSCROLL_TO_NEW_LOCALS);
myCbDfaAssist.setSelected(generalSettings.USE_DFA_ASSIST);
myCbHideNullArrayElements.setSelected(generalSettings.HIDE_NULL_ARRAY_ELEMENTS);
myCbEnableAlternateViews.setSelected(rendererSettings.areAlternateCollectionViewsEnabled());
myCbPopulateThrowableStack.setSelected(generalSettings.POPULATE_THROWABLE_STACKTRACE);
@@ -256,6 +261,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private boolean areGeneralSettingsModified() {
ViewsGeneralSettings generalSettings = ViewsGeneralSettings.getInstance();
return generalSettings.AUTOSCROLL_TO_NEW_LOCALS != myCbAutoscroll.isSelected() ||
generalSettings.USE_DFA_ASSIST != myCbDfaAssist.isSelected() ||
generalSettings.HIDE_NULL_ARRAY_ELEMENTS != myCbHideNullArrayElements.isSelected() ||
generalSettings.POPULATE_THROWABLE_STACKTRACE != myCbPopulateThrowableStack.isSelected();
}

View File

@@ -16,6 +16,7 @@ public class ViewsGeneralSettings implements PersistentStateComponent<ViewsGener
public boolean SHOW_OBJECTID = true;
public boolean HIDE_NULL_ARRAY_ELEMENTS = true;
public boolean AUTOSCROLL_TO_NEW_LOCALS = true;
public boolean USE_DFA_ASSIST = true;
public boolean POPULATE_THROWABLE_STACKTRACE = true;
public static ViewsGeneralSettings getInstance() {
@@ -38,6 +39,7 @@ public class ViewsGeneralSettings implements PersistentStateComponent<ViewsGener
return SHOW_OBJECTID == generalSettings.SHOW_OBJECTID &&
HIDE_NULL_ARRAY_ELEMENTS == generalSettings.HIDE_NULL_ARRAY_ELEMENTS &&
AUTOSCROLL_TO_NEW_LOCALS == generalSettings.AUTOSCROLL_TO_NEW_LOCALS &&
POPULATE_THROWABLE_STACKTRACE == generalSettings.POPULATE_THROWABLE_STACKTRACE;
POPULATE_THROWABLE_STACKTRACE == generalSettings.POPULATE_THROWABLE_STACKTRACE &&
USE_DFA_ASSIST == generalSettings.USE_DFA_ASSIST;
}
}

View File

@@ -1483,8 +1483,6 @@ debugger.show.values.inplace=false
debugger.show.values.inplace.description=Show primitive values near variables inside current execution line
debugger.show.values.between.lines=false
debugger.show.values.between.lines.description=Show variable values below their definition place
debugger.show.values.from.dfa=true
debugger.show.values.from.dfa.description=Enrich debug session with dataflow output (Java only)
ide.projectView.ProjectViewPaneTreeStructure.BuildChildrenInBackground=false
ide.projectView.ProjectViewPaneTreeStructure.BuildChildrenInBackground.description=Temporary ability to control a tree building for the Project View pane

View File

@@ -197,6 +197,7 @@ label.array.renderer.configurable.end.index=en&d index:
label.array.renderer.configurable.max.count1=Show &maximum
label.array.renderer.configurable.max.count2=array elements
label.base.renderer.configurable.autoscroll=Autoscroll to new &local variables
label.base.renderer.configurable.dfa.assist=Predict future condition values analyzing program data flow
label.base.renderer.configurable.show.synthetic.fields=S&ynthetic fields
label.base.renderer.configurable.show.val.fields.as.locals=$val fields as local &variables
label.base.renderer.configurable.sort.alphabetically=Sort a&lphabetically