summaryrefslogtreecommitdiff
path: root/platform/xdebugger-impl/src/com/intellij
diff options
context:
space:
mode:
Diffstat (limited to 'platform/xdebugger-impl/src/com/intellij')
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java9
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java2
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java7
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java2
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java15
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java9
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java8
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java61
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java22
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java3
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java53
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form50
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java61
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java125
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java82
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java27
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java51
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form34
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java52
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java118
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java41
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java180
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java30
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java10
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java32
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java49
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java12
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java20
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java2
35 files changed, 1044 insertions, 150 deletions
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
index 82c052240673..840163bb9e43 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -36,6 +36,9 @@ import org.jetbrains.annotations.Nullable;
public abstract class DebuggerSupport {
private static final ExtensionPointName<DebuggerSupport> EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.debuggerSupport");
+ private static final DebuggerSettingsPanelProvider EMPTY_SETTINGS_PANEL_PROVIDER = new DebuggerSettingsPanelProvider() {
+ };
+
protected static final class DisabledActionHandler extends DebuggerActionHandler {
public static final DisabledActionHandler INSTANCE = new DisabledActionHandler();
@@ -58,7 +61,9 @@ public abstract class DebuggerSupport {
public abstract BreakpointPanelProvider<?> getBreakpointPanelProvider();
@NotNull
- public abstract DebuggerSettingsPanelProvider getSettingsPanelProvider();
+ public DebuggerSettingsPanelProvider getSettingsPanelProvider() {
+ return EMPTY_SETTINGS_PANEL_PROVIDER;
+ }
@NotNull
public abstract DebuggerActionHandler getStepOverHandler();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index bdedcc29091a..9ab13ba0ae74 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -865,7 +865,7 @@ public class XDebugSessionImpl implements XDebugSession {
if (myValueMarkers != null) {
myValueMarkers.clear();
}
- if (XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop()) {
+ if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) {
mySessionData.setBreakpointsMuted(false);
}
myStopped = true;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
index eee1f28ad451..b974150d2c56 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
@@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl;
import com.intellij.AppTopics;
import com.intellij.execution.ExecutionException;
+import com.intellij.execution.ExecutionManager;
import com.intellij.execution.Executor;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.process.ProcessHandler;
@@ -27,6 +28,7 @@ import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunContentManagerImpl;
import com.intellij.execution.ui.RunContentWithExecutorListener;
import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
@@ -45,6 +47,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
+import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter;
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
@@ -245,6 +248,10 @@ public class XDebuggerManagerImpl extends XDebuggerManager
mySessions.remove(session.getDebugProcess().getProcessHandler());
}
});
+
+ if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
+ ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
+ }
}
if (myActiveSession == session) {
myActiveSession = null;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
index 6db46f58d266..8e51cefab29a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
@@ -156,7 +156,7 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
@Override
public <T extends XDebuggerSettings<?>> T getDebuggerSettings(Class<T> aClass) {
- return XDebuggerSettingsManager.getInstance().getSettings(aClass);
+ return XDebuggerSettingsManager.getInstanceImpl().getSettings(aClass);
}
@Override
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
index 79cef654c089..e9f36996dda7 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
@@ -26,11 +26,11 @@ import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
public class UnmuteOnStopAction extends ToggleAction implements DumbAware {
@Override
public boolean isSelected(AnActionEvent e) {
- return XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop();
+ return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
- XDebuggerSettingsManager.getInstance().getGeneralSettings().setUnmuteOnStop(state);
+ XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().setUnmuteOnStop(state);
}
} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
index 8631b8fc901b..364353c2ac63 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
@@ -156,11 +156,11 @@ public class BreakpointState<B extends XBreakpoint<P>, P extends XBreakpointProp
}
public boolean isLogExpressionEnabled() {
- return myLogExpression == null || !myLogExpression.myDisabled;
+ return myLogExpression != null && !myLogExpression.myDisabled;
}
public boolean isConditionEnabled() {
- return myCondition == null || !myCondition.myDisabled;
+ return myCondition != null && !myCondition.myDisabled;
}
@Property(surroundWithTag = false)
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
index 6184ad9857b3..ddf673fe2504 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
@@ -192,6 +192,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setLogExpression(@Nullable final String expression) {
+ setLogExpressionEnabled(true);
if (!Comparing.equal(getLogExpression(), expression)) {
myLogExpression = XExpressionImpl.fromText(expression);
fireBreakpointChanged();
@@ -210,6 +211,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setLogExpressionObject(@Nullable XExpression expression) {
+ setLogExpressionEnabled(true);
if (!Comparing.equal(myLogExpression, expression)) {
myLogExpression = expression;
fireBreakpointChanged();
@@ -224,6 +226,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setCondition(@Nullable final String condition) {
+ setConditionEnabled(true);
if (!Comparing.equal(condition, getCondition())) {
myCondition = XExpressionImpl.fromText(condition);
fireBreakpointChanged();
@@ -242,6 +245,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setConditionExpression(@Nullable XExpression condition) {
+ setConditionEnabled(true);
if (!Comparing.equal(condition, myCondition)) {
myCondition = condition;
fireBreakpointChanged();
@@ -387,13 +391,18 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Nullable
protected final Icon calculateSpecialIcon() {
+ XDebugSessionImpl session = getBreakpointManager().getDebuggerManager().getCurrentSession();
if (!isEnabled()) {
// disabled icon takes precedence to other to visually distinguish it and provide feedback then it is enabled/disabled
// (e.g. in case of mute-mode we would like to differentiate muted but enabled breakpoints from simply disabled ones)
- return getType().getDisabledIcon();
+ if (session == null || !session.areBreakpointsMuted()) {
+ return getType().getDisabledIcon();
+ }
+ else {
+ return getType().getMutedDisabledIcon();
+ }
}
- XDebugSessionImpl session = getBreakpointManager().getDebuggerManager().getCurrentSession();
if (session == null) {
if (getBreakpointManager().getDependentBreakpointManager().getMasterBreakpoint(this) != null) {
return getType().getInactiveDependentIcon();
@@ -401,7 +410,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
}
else {
if (session.areBreakpointsMuted()) {
- return AllIcons.Debugger.Db_muted_breakpoint;
+ return getType().getMutedEnabledIcon();
}
if (session.isInactiveSlaveBreakpoint(this)) {
return getType().getInactiveDependentIcon();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
index d86970b463f4..e2ce9ca7c63d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
@@ -90,8 +90,9 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak
RangeHighlighterEx highlighter = myHighlighter;
if (highlighter != null &&
- (!highlighter.isValid() ||
- highlighter.getStartOffset() >= document.getTextLength()
+ (!highlighter.isValid()
+ || highlighter.getStartOffset() >= document.getTextLength()
+ || !Comparing.equal(highlighter.getTextAttributes(), attributes)
// it seems that this check is not needed - we always update line number from the highlighter
// and highlighter is removed on line and file change anyway
/*|| document.getLineNumber(highlighter.getStartOffset()) != getLine()*/)) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
index e2252ea642a9..098b64052284 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
@@ -118,14 +118,7 @@ public class XLineBreakpointManager {
// Update breakpoints colors if global color schema was changed
final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
- final MyEditorColorsListener myColorsSchemeListener = new MyEditorColorsListener();
- Disposer.register(project, new Disposable() {
- @Override
- public void dispose() {
- colorsManager.removeEditorColorsListener(myColorsSchemeListener);
- }
- });
- colorsManager.addEditorColorsListener(myColorsSchemeListener);
+ colorsManager.addEditorColorsListener(new MyEditorColorsListener(), project);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
index 0f98bce57af0..6ee8eadbe0ad 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
@@ -114,9 +114,10 @@ public class XBreakpointActionsPanel<B extends XBreakpointBase<?,?,?>> extends X
}
if (myLogExpressionComboBox != null) {
- myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected());
XExpression expression = myLogExpressionComboBox.getExpression();
- myBreakpoint.setLogExpressionObject(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
+ XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
+ myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected() && logExpression != null);
+ myBreakpoint.setLogExpressionObject(logExpression);
myLogExpressionComboBox.saveTextInHistory();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
index 9f869ac25def..0e847d7db05d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
@@ -206,9 +206,10 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
}
if (myConditionComboBox != null) {
- myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected());
XExpression expression = myConditionComboBox.getExpression();
- myBreakpoint.setConditionExpression(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
+ XExpression condition = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
+ myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected() && condition != null);
+ myBreakpoint.setConditionExpression(condition);
myConditionComboBox.saveTextInHistory();
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
index a272cb30321f..15a8bf6aed84 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
@@ -16,6 +16,9 @@
package com.intellij.xdebugger.impl.evaluate;
import com.intellij.openapi.project.Project;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.components.JBLabel;
+import com.intellij.util.ui.UIUtil;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.XSourcePosition;
@@ -53,6 +56,11 @@ public class ExpressionInputComponent extends EvaluationInputComponent {
public void addComponent(JPanel contentPanel, JPanel resultPanel) {
contentPanel.add(resultPanel, BorderLayout.CENTER);
contentPanel.add(myMainPanel, BorderLayout.NORTH);
+ final JBLabel hint = new JBLabel(XDebuggerBundle.message("xdebugger.evaluate.addtowatches.hint"), SwingConstants.RIGHT);
+ hint.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 6, 0));
+ hint.setComponentStyle(UIUtil.ComponentStyle.SMALL);
+ hint.setFontColor(UIUtil.FontColor.BRIGHTER);
+ contentPanel.add(hint, BorderLayout.SOUTH);
}
protected XDebuggerEditorBase getInputEditor() {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
index 2ad50e1240f7..2273ab698768 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.xdebugger.*;
@@ -28,26 +29,23 @@ import com.intellij.xdebugger.evaluation.EvaluationMode;
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.XDebuggerEditorBase;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
-import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel;
import com.intellij.xdebugger.impl.ui.tree.nodes.EvaluatingExpressionRootNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.RestorableStateNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.tree.TreeNode;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
-import java.util.List;
/**
* @author nik
@@ -98,12 +96,6 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
mySwitchModeAction = new SwitchModeAction();
- new AnAction(){
- @Override
- public void actionPerformed(AnActionEvent e) {
- doOKAction();
- }
- }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)), getRootPane(), myDisposable);
new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
@@ -112,9 +104,14 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK)), getRootPane(),
myDisposable);
- myTreePanel.getTree().addTreeListener(new MyTreeListener());
+ myTreePanel.getTree().expandNodesOnLoad(new Condition<TreeNode>() {
+ @Override
+ public boolean value(TreeNode node) {
+ return node.getParent() instanceof EvaluatingExpressionRootNode;
+ }
+ });
- EvaluationMode mode = XDebuggerSettingsManager.getInstance().getGeneralSettings().getEvaluationDialogMode();
+ EvaluationMode mode = XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().getEvaluationDialogMode();
myIsCodeFragmentEvaluationSupported = evaluator.isCodeFragmentEvaluationSupported();
if (mode == EvaluationMode.CODE_FRAGMENT && !myIsCodeFragmentEvaluationSupported) {
mode = EvaluationMode.EXPRESSION;
@@ -131,6 +128,23 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
evaluate();
}
+ protected void createDefaultActions() {
+ super.createDefaultActions();
+ myOKAction = new OkAction(){
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (myMode == EvaluationMode.EXPRESSION && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
+ // add to watches
+ XExpression expression = myInputComponent.getInputEditor().getExpression();
+ if (!XDebuggerUtilImpl.isEmptyExpression(expression)) {
+ ((XDebugSessionImpl)mySession).getSessionTab().getWatchesView().addWatchExpression(expression, -1, false);
+ }
+ }
+ }
+ };
+ }
+
@NotNull
@Override
protected Action[] createActions() {
@@ -171,7 +185,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
private void switchToMode(EvaluationMode mode, XExpression text) {
if (myMode == mode) return;
- XDebuggerSettingsManager.getInstance().getGeneralSettings().setEvaluationDialogMode(mode);
+ XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().setEvaluationDialogMode(mode);
myMode = mode;
@@ -227,25 +241,6 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}
}
- private class MyTreeListener implements XDebuggerTreeListener {
- @Override
- public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
- if (node.getParent() instanceof EvaluatingExpressionRootNode) {
- if (!node.isLeaf()) {
- // cause children computing
- node.getChildCount();
- }
- }
- }
-
- @Override
- public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
- if (node.getParent() instanceof EvaluatingExpressionRootNode) {
- myTreePanel.getTree().expandPath(node.getPath());
- }
- }
- }
-
@Override
protected String getDimensionServiceKey() {
return "#xdebugger.evaluate";
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
index 8f53dba017f9..c07b140e2622 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
@@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl.evaluate.quick;
import com.intellij.concurrency.ResultConsumer;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.xdebugger.XSourcePosition;
@@ -26,14 +27,10 @@ import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.evaluate.quick.common.DebuggerTreeCreator;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
-import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
-import com.intellij.xdebugger.impl.ui.tree.nodes.RestorableStateNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
+import javax.swing.tree.TreeNode;
public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,String>> {
@NotNull private final Project myProject;
@@ -56,19 +53,10 @@ public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,Str
final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), descriptor.getFirst());
tree.setRoot(root, true);
// expand root on load
- tree.addTreeListener(new XDebuggerTreeListener() {
+ tree.expandNodesOnLoad(new Condition<TreeNode>() {
@Override
- public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
- if (node == root && !node.isLeaf()) {
- node.getChildCount();
- }
- }
-
- @Override
- public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
- if (node == root) {
- tree.expandPath(node.getPath());
- }
+ public boolean value(TreeNode node) {
+ return node == root;
}
});
return tree;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
index 1669e102f15f..bf3e0010e6cf 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
@@ -29,6 +29,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueHintType;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -107,6 +108,6 @@ public class XQuickEvaluateHandler extends QuickEvaluateHandler {
return evaluator.getValuePopupDelay();
}
}
- return 700;
+ return XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java
new file mode 100644
index 000000000000..d140a74f35c8
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.XDebuggerBundle;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+class DataViewsConfigurable extends SubCompositeConfigurable implements Configurable.NoScroll {
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.dataViews";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return XDebuggerBundle.message("debugger.dataViews.display.name");
+ }
+
+ @Override
+ protected DataViewsConfigurableUi createRootUi() {
+ return new DataViewsConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ protected XDebuggerSettings.Category getCategory() {
+ return XDebuggerSettings.Category.DATA_VIEWS;
+ }
+
+ @NotNull
+ @Override
+ protected XDebuggerDataViewSettings getSettings() {
+ return XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings();
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form
new file mode 100644
index 000000000000..a6e3f94f3bec
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.settings.DataViewsConfigurableUi">
+ <grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <vspacer id="4eb98">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="9a000" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.value.tooltip.delay.label"/>
+ </properties>
+ </component>
+ <component id="fdcd5" class="javax.swing.JFormattedTextField" binding="valueTooltipDelayTextField">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <columns value="4"/>
+ </properties>
+ </component>
+ <component id="98130" class="javax.swing.JCheckBox" binding="enableAutoExpressionsCheckBox">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.enable.auto.expressions.label"/>
+ </properties>
+ </component>
+ <component id="a57b4" class="javax.swing.JCheckBox" binding="sortAlphabeticallyCheckBox" default-binding="true">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.sort.alphabetically.label"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+</form>
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
new file mode 100644
index 000000000000..76645db3a3d3
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.util.text.StringUtilRt;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+public class DataViewsConfigurableUi {
+ private JCheckBox enableAutoExpressionsCheckBox;
+ private JFormattedTextField valueTooltipDelayTextField;
+ private JPanel panel;
+ private JCheckBox sortAlphabeticallyCheckBox;
+
+ public DataViewsConfigurableUi() {
+ UIUtil.configureNumericFormattedTextField(valueTooltipDelayTextField);
+ }
+
+ private int getValueTooltipDelay() {
+ Object value = valueTooltipDelayTextField.getValue();
+ return value instanceof Number ? ((Number)value).intValue() : StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
+ }
+
+ @NotNull
+ public JComponent getComponent() {
+ return panel;
+ }
+
+ public boolean isModified(@NotNull XDebuggerDataViewSettings settings) {
+ return getValueTooltipDelay() != settings.getValueLookupDelay() ||
+ sortAlphabeticallyCheckBox.isSelected() != settings.isSortValues() ||
+ enableAutoExpressionsCheckBox.isSelected() != settings.isAutoExpressions();
+ }
+
+ public void reset(@NotNull XDebuggerDataViewSettings settings) {
+ valueTooltipDelayTextField.setValue(settings.getValueLookupDelay());
+ sortAlphabeticallyCheckBox.setSelected(settings.isSortValues());
+ enableAutoExpressionsCheckBox.setSelected(settings.isAutoExpressions());
+ }
+
+ public void apply(@NotNull XDebuggerDataViewSettings settings) {
+ settings.setValueLookupDelay(getValueTooltipDelay());
+ settings.setSortValues(sortAlphabeticallyCheckBox.isSelected());
+ settings.setAutoExpressions(enableAutoExpressionsCheckBox.isSelected());
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
index ae0b71eaa20f..a3f4e847288c 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,12 +18,19 @@ package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.SmartList;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
/**
@@ -31,26 +38,118 @@ import java.util.List;
*/
public class DebuggerConfigurable implements SearchableConfigurable.Parent {
public static final String DISPLAY_NAME = XDebuggerBundle.message("debugger.configurable.display.name");
+
+ static final Configurable[] EMPTY_CONFIGURABLES = new Configurable[0];
+
private Configurable myRootConfigurable;
private Configurable[] myChildren;
- public DebuggerConfigurable(Configurable rootConfigurable, List<Configurable> children) {
- myRootConfigurable = rootConfigurable;
- myChildren = children.toArray(new Configurable[children.size()]);
- }
-
+ @Override
public String getDisplayName() {
return DISPLAY_NAME;
}
+ @Override
public String getHelpTopic() {
- return myRootConfigurable != null? myRootConfigurable.getHelpTopic() : null;
+ return myRootConfigurable != null ? myRootConfigurable.getHelpTopic() : null;
}
+ @Override
public Configurable[] getConfigurables() {
- return myChildren;
+ compute();
+
+ if (myChildren.length == 0 && myRootConfigurable instanceof SearchableConfigurable.Parent) {
+ return ((Parent)myRootConfigurable).getConfigurables();
+ }
+ else {
+ return myChildren;
+ }
+ }
+
+ private void compute() {
+ if (myChildren != null) {
+ return;
+ }
+
+ List<DebuggerSettingsPanelProvider> providers = DebuggerConfigurableProvider.getSortedProviders();
+
+ List<Configurable> configurables = new SmartList<Configurable>();
+ configurables.add(new DataViewsConfigurable());
+
+ List<Configurable> steppingConfigurables = DebuggerConfigurableProvider.getConfigurables(XDebuggerSettings.Category.STEPPING, providers);
+ if (!steppingConfigurables.isEmpty()) {
+ configurables.add(new SteppingConfigurable(steppingConfigurables));
+ }
+
+ Configurable rootConfigurable = computeRootConfigurable(providers, configurables);
+
+ if (configurables.isEmpty() && rootConfigurable == null) {
+ myChildren = EMPTY_CONFIGURABLES;
+ }
+ else if (rootConfigurable == null && configurables.size() == 1) {
+ myRootConfigurable = configurables.get(0);
+ myChildren = EMPTY_CONFIGURABLES;
+ }
+ else {
+ myChildren = configurables.toArray(new Configurable[configurables.size()]);
+ myRootConfigurable = rootConfigurable;
+ }
+ }
+
+ @Nullable
+ private static Configurable computeRootConfigurable(@NotNull List<DebuggerSettingsPanelProvider> providers, @NotNull List<Configurable> configurables) {
+ Configurable deprecatedRootConfigurable = null;
+ for (DebuggerSettingsPanelProvider provider : providers) {
+ configurables.addAll(provider.getConfigurables());
+ @SuppressWarnings("deprecation")
+ Configurable providerRootConfigurable = provider.getRootConfigurable();
+ if (providerRootConfigurable != null) {
+ if (deprecatedRootConfigurable == null) {
+ deprecatedRootConfigurable = providerRootConfigurable;
+ }
+ else {
+ configurables.add(providerRootConfigurable);
+ }
+ }
+ }
+
+ List<Configurable> rootConfigurables = DebuggerConfigurableProvider.getConfigurables(XDebuggerSettings.Category.ROOT, providers);
+ if (rootConfigurables.isEmpty()) {
+ return deprecatedRootConfigurable;
+ }
+ else {
+ Configurable[] mergedRootConfigurables = new Configurable[rootConfigurables.size() + (deprecatedRootConfigurable == null ? 0 : 1)];
+ rootConfigurables.toArray(mergedRootConfigurables);
+ if (deprecatedRootConfigurable != null) {
+ mergedRootConfigurables[rootConfigurables.size()] = deprecatedRootConfigurable;
+ }
+
+ // move unnamed to top
+ Arrays.sort(mergedRootConfigurables, new Comparator<Configurable>() {
+ @Override
+ public int compare(Configurable o1, Configurable o2) {
+ boolean c1e = StringUtil.isEmpty(o1.getDisplayName());
+ return c1e == StringUtil.isEmpty(o2.getDisplayName()) ? 0 : (c1e ? -1 : 1);
+ }
+ });
+
+ return new MergedCompositeConfigurable(mergedRootConfigurables) {
+ @NotNull
+ @Override
+ public String getId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
}
+ @Override
public void apply() throws ConfigurationException {
for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
support.getSettingsPanelProvider().apply();
@@ -60,38 +159,48 @@ public class DebuggerConfigurable implements SearchableConfigurable.Parent {
}
}
+ @Override
public boolean hasOwnContent() {
+ compute();
return myRootConfigurable != null;
}
+ @Override
public boolean isVisible() {
return true;
}
+ @Override
public Runnable enableSearch(final String option) {
return null;
}
+ @Override
public JComponent createComponent() {
+ compute();
return myRootConfigurable != null ? myRootConfigurable.createComponent() : null;
}
+ @Override
public boolean isModified() {
return myRootConfigurable != null && myRootConfigurable.isModified();
}
+ @Override
public void reset() {
if (myRootConfigurable != null) {
myRootConfigurable.reset();
}
}
+ @Override
public void disposeUIResources() {
if (myRootConfigurable != null) {
myRootConfigurable.disposeUIResources();
}
}
+ @Override
@NotNull
@NonNls
public String getId() {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
index 49e2e4ac6fcd..80651cadc830 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
@@ -17,10 +17,13 @@ package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableProvider;
-import com.intellij.util.PlatformUtils;
+import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -29,46 +32,55 @@ import java.util.List;
* @author nik
*/
public class DebuggerConfigurableProvider extends ConfigurableProvider {
+ @NotNull
+ static List<DebuggerSettingsPanelProvider> getSortedProviders() {
+ List<DebuggerSettingsPanelProvider> providers = null;
+ for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
+ DebuggerSettingsPanelProvider provider = support.getSettingsPanelProvider();
+ if (providers == null) {
+ providers = new SmartList<DebuggerSettingsPanelProvider>();
+ }
+ providers.add(provider);
+ }
+
+ if (ContainerUtil.isEmpty(providers)) {
+ return Collections.emptyList();
+ }
+
+ if (providers.size() > 1) {
+ Collections.sort(providers, new Comparator<DebuggerSettingsPanelProvider>() {
+ @Override
+ public int compare(DebuggerSettingsPanelProvider o1, DebuggerSettingsPanelProvider o2) {
+ return o2.getPriority() - o1.getPriority();
+ }
+ });
+ }
+ return providers;
+ }
+
@Override
public Configurable createConfigurable() {
- final List<DebuggerSettingsPanelProvider> providers = new ArrayList<DebuggerSettingsPanelProvider>();
- final DebuggerSupport[] supports = DebuggerSupport.getDebuggerSupports();
- for (DebuggerSupport support : supports) {
- providers.add(support.getSettingsPanelProvider());
- }
+ return new DebuggerConfigurable();
+ }
- List<Configurable> configurables = new ArrayList<Configurable>();
- Collections.sort(providers, new Comparator<DebuggerSettingsPanelProvider>() {
- public int compare(final DebuggerSettingsPanelProvider o1, final DebuggerSettingsPanelProvider o2) {
- return o2.getPriority() - o1.getPriority();
- }
- });
+ @NotNull
+ static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category) {
+ List<DebuggerSettingsPanelProvider> providers = getSortedProviders();
+ return providers.isEmpty() ? Collections.<Configurable>emptyList() : getConfigurables(category, providers);
+ }
- Configurable rootConfigurable = null;
+ @NotNull
+ static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category, @NotNull List<DebuggerSettingsPanelProvider> providers) {
+ List<Configurable> configurables = null;
for (DebuggerSettingsPanelProvider provider : providers) {
- configurables.addAll(provider.getConfigurables());
- final Configurable aRootConfigurable = provider.getRootConfigurable();
- if (aRootConfigurable != null) {
- if (rootConfigurable != null) {
- configurables.add(aRootConfigurable);
- }
- else {
- rootConfigurable = aRootConfigurable;
+ Collection<? extends Configurable> providerConfigurables = provider.getConfigurable(category);
+ if (!providerConfigurables.isEmpty()) {
+ if (configurables == null) {
+ configurables = new SmartList<Configurable>();
}
+ configurables.addAll(providerConfigurables);
}
}
- if (configurables.isEmpty() && rootConfigurable == null) {
- return null;
- }
-
- //Perhaps we always should have a root node 'Debugger' with separate nodes for language-specific settings under it.
- //However for AppCode there is only one language which is clearly associated with the product
- //This code should removed when we extract the common debugger settings to the root node.
- if (PlatformUtils.isCidr() && rootConfigurable == null && configurables.size() == 1) {
- rootConfigurable = configurables.get(0);
- configurables = Collections.emptyList();
- }
-
- return new DebuggerConfigurable(rootConfigurable, configurables);
+ return ContainerUtil.notNullize(configurables);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
index ba0bb43621e9..68e6de064b9a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,24 +16,43 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
+import java.util.Collections;
/**
* @author nik
*/
public abstract class DebuggerSettingsPanelProvider {
+ public int getPriority() {
+ return 0;
+ }
- public abstract int getPriority();
-
- public abstract Collection<? extends Configurable> getConfigurables();
+ @NotNull
+ public Collection<? extends Configurable> getConfigurables() {
+ return Collections.emptyList();
+ }
public void apply() {
}
@Nullable
+ @Deprecated
public Configurable getRootConfigurable() {
return null;
}
+
+ @NotNull
+ public Collection<? extends Configurable> getConfigurable(@NotNull XDebuggerSettings.Category category) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * General settings of category were applied
+ */
+ public void generalApplied(@NotNull XDebuggerSettings.Category category) {
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java
new file mode 100644
index 000000000000..466279bce977
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.ConfigurableBase;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class GeneralConfigurable extends ConfigurableBase<GeneralConfigurableUi, XDebuggerGeneralSettings> {
+ @Override
+ protected XDebuggerGeneralSettings getSettings() {
+ return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings();
+ }
+
+ @Override
+ protected GeneralConfigurableUi createUi() {
+ return new GeneralConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.general";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return "";
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form
new file mode 100644
index 000000000000..4d1f8e52d24f
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.settings.GeneralConfigurableUi">
+ <grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="4b50" class="javax.swing.JCheckBox" binding="hideDebugWindowCheckBox">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.hide.window.label"/>
+ </properties>
+ </component>
+ <vspacer id="8e2ed">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="fc652" class="javax.swing.JCheckBox" binding="focusApplicationOnBreakpointCheckBox" default-binding="true">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.focus.app.on.breakpoint.label"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+</form>
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java
new file mode 100644
index 000000000000..273c5490e35d
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.ConfigurableUi;
+import com.intellij.openapi.util.registry.Registry;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+class GeneralConfigurableUi implements ConfigurableUi<XDebuggerGeneralSettings> {
+ private JPanel rootPanel;
+ private JCheckBox hideDebugWindowCheckBox;
+ private JCheckBox focusApplicationOnBreakpointCheckBox;
+
+ @Override
+ public void reset(@NotNull XDebuggerGeneralSettings settings) {
+ focusApplicationOnBreakpointCheckBox.setSelected(Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
+ hideDebugWindowCheckBox.setSelected(settings.isHideDebuggerOnProcessTermination());
+ }
+
+ @Override
+ public boolean isModified(@NotNull XDebuggerGeneralSettings settings) {
+ return focusApplicationOnBreakpointCheckBox.isSelected() != Registry.is("debugger.mayBringFrameToFrontOnBreakpoint") ||
+ hideDebugWindowCheckBox.isSelected() != settings.isHideDebuggerOnProcessTermination();
+ }
+
+ @Override
+ public void apply(@NotNull XDebuggerGeneralSettings settings) {
+ Registry.get("debugger.mayBringFrameToFrontOnBreakpoint").setValue(focusApplicationOnBreakpointCheckBox.isSelected());
+ settings.setHideDebuggerOnProcessTermination(hideDebugWindowCheckBox.isSelected());
+ }
+
+ @NotNull
+ @Override
+ public JComponent getComponent() {
+ return rootPanel;
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java
new file mode 100644
index 000000000000..be0bdbf0ab2f
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java
@@ -0,0 +1,118 @@
+package com.intellij.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.ui.VerticalFlowLayout;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.TitledSeparator;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+
+abstract class MergedCompositeConfigurable implements SearchableConfigurable {
+ static final EmptyBorder BOTTOM_INSETS = new EmptyBorder(0, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0);
+
+ protected final Configurable[] children;
+ protected JComponent rootComponent;
+
+ protected MergedCompositeConfigurable(@NotNull Configurable[] children) {
+ this.children = children;
+ }
+
+ protected boolean isUseTitledBorder() {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return children.length == 1 ? children[0].getHelpTopic() : null;
+ }
+
+ @Nullable
+ @Override
+ public JComponent createComponent() {
+ if (rootComponent == null) {
+ if (children.length == 1) {
+ rootComponent = children[0].createComponent();
+ }
+ else {
+ JPanel panel = createPanel(isUseTitledBorder());
+ for (Configurable child : children) {
+ JComponent component = child.createComponent();
+ assert component != null;
+ if (isUseTitledBorder()) {
+ String displayName = child.getDisplayName();
+ if (StringUtil.isEmpty(displayName)) {
+ component.setBorder(BOTTOM_INSETS);
+ }
+ else {
+ Insets insets = new Insets(children[0] == child ? 0 : IdeBorderFactory.TITLED_BORDER_TOP_INSET, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0);
+ component.setBorder(IdeBorderFactory.createTitledBorder(displayName, false, insets));
+ }
+ }
+ panel.add(component);
+ }
+ rootComponent = panel;
+ }
+ }
+ return rootComponent;
+ }
+
+ @NotNull
+ static JPanel createPanel(boolean isUseTitledBorder) {
+ int verticalGap = TitledSeparator.TOP_INSET;
+ JPanel panel = new JPanel(new VerticalFlowLayout(0, isUseTitledBorder ? 0 : verticalGap));
+ // VerticalFlowLayout incorrectly use vertical gap as top inset
+ if (!isUseTitledBorder) {
+ panel.setBorder(new EmptyBorder(-verticalGap, 0, 0, 0));
+ }
+ return panel;
+ }
+
+ @Override
+ public boolean isModified() {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void apply() throws ConfigurationException {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ child.apply();
+ }
+ }
+ }
+
+ @Override
+ public void reset() {
+ for (Configurable child : children) {
+ child.reset();
+ }
+ }
+
+ @Override
+ public void disposeUIResources() {
+ rootComponent = null;
+
+ for (Configurable child : children) {
+ child.disposeUIResources();
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java
new file mode 100644
index 000000000000..5f16424c1790
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.XDebuggerBundle;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+class SteppingConfigurable extends MergedCompositeConfigurable {
+ public SteppingConfigurable(@NotNull List<Configurable> configurables) {
+ super(configurables.toArray(new Configurable[configurables.size()]));
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.stepping";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return XDebuggerBundle.message("debugger.stepping.display.name");
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java
new file mode 100644
index 000000000000..489e4bd80307
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.ui.VerticalFlowLayout;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.util.List;
+
+abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent {
+ protected DataViewsConfigurableUi root;
+ protected Configurable[] children;
+ protected JComponent rootComponent;
+
+ @Override
+ public boolean hasOwnContent() {
+ return true;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ getConfigurables();
+ return children != null && children.length == 1 ? children[0].getHelpTopic() : null;
+ }
+
+ @Override
+ public final void disposeUIResources() {
+ root = null;
+ rootComponent = null;
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ child.disposeUIResources();
+ }
+ }
+ children = null;
+ }
+
+ protected XDebuggerDataViewSettings getSettings() {
+ return null;
+ }
+
+ @Nullable
+ protected abstract DataViewsConfigurableUi createRootUi();
+
+ @NotNull
+ protected abstract XDebuggerSettings.Category getCategory();
+
+ private boolean isChildrenMerged() {
+ return children != null && children.length == 1;
+ }
+
+ @Override
+ public final Configurable[] getConfigurables() {
+ if (children == null) {
+ List<Configurable> configurables = DebuggerConfigurableProvider.getConfigurables(getCategory());
+ children = configurables.toArray(new Configurable[configurables.size()]);
+ }
+ return isChildrenMerged() ? DebuggerConfigurable.EMPTY_CONFIGURABLES : children;
+ }
+
+ @Nullable
+ @Override
+ public final JComponent createComponent() {
+ if (rootComponent == null) {
+ if (root == null) {
+ root = createRootUi();
+ }
+
+ getConfigurables();
+ if (isChildrenMerged()) {
+ if (children.length == 0) {
+ rootComponent = root == null ? null : root.getComponent();
+ }
+ else if (root == null && children.length == 1) {
+ rootComponent = children[0].createComponent();
+ }
+ else {
+ JPanel panel = new JPanel(new VerticalFlowLayout(0, 0));
+ if (root != null) {
+ JComponent c = root.getComponent();
+ c.setBorder(MergedCompositeConfigurable.BOTTOM_INSETS);
+ panel.add(c);
+ }
+ for (Configurable child : children) {
+ JComponent component = child.createComponent();
+ if (component != null) {
+ component.setBorder(IdeBorderFactory.createTitledBorder(child.getDisplayName(), false));
+ panel.add(component);
+ }
+ }
+ rootComponent = panel;
+ }
+ }
+ else {
+ rootComponent = root == null ? null : root.getComponent();
+ }
+ }
+ return rootComponent;
+ }
+
+ @Override
+ public final void reset() {
+ if (root != null) {
+ root.reset(getSettings());
+ }
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ child.reset();
+ }
+ }
+ }
+
+ @Override
+ public final boolean isModified() {
+ if (root != null && root.isModified(getSettings())) {
+ return true;
+ }
+ else if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public final void apply() throws ConfigurationException {
+ if (root != null) {
+ root.apply(getSettings());
+ for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
+ support.getSettingsPanelProvider().generalApplied(getCategory());
+ }
+ }
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ child.apply();
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
index bff7c531119d..3dd802430ecf 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,15 +16,21 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.util.xmlb.annotations.Tag;
-import com.intellij.xdebugger.evaluation.EvaluationMode;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
/**
* @author nik
*/
@Tag("data-views")
-public class XDebuggerDataViewSettings {
+public class XDebuggerDataViewSettings implements XDebuggerSettingsManager.DataViewSettings {
+ static final int DEFAULT_VALUE_TOOLTIP_DELAY = 700;
+
private boolean mySortValues;
+ private boolean autoExpressions = true;
+ private int valueLookupDelay = DEFAULT_VALUE_TOOLTIP_DELAY;
+
+ @Override
@Tag("sort-values")
public boolean isSortValues() {
return mySortValues;
@@ -33,4 +39,22 @@ public class XDebuggerDataViewSettings {
public void setSortValues(boolean sortValues) {
mySortValues = sortValues;
}
+
+ @Override
+ public int getValueLookupDelay() {
+ return valueLookupDelay;
+ }
+
+ public void setValueLookupDelay(int value) {
+ valueLookupDelay = value;
+ }
+
+ @Override
+ public boolean isAutoExpressions() {
+ return autoExpressions;
+ }
+
+ public void setAutoExpressions(boolean autoExpressions) {
+ this.autoExpressions = autoExpressions;
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
index 1f89b1445fd1..9720d9517c51 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
@@ -26,6 +26,8 @@ public class XDebuggerGeneralSettings {
private EvaluationMode myEvaluationDialogMode = EvaluationMode.EXPRESSION;
private boolean myUnmuteOnStop = false;
+ private boolean hideDebuggerOnProcessTermination;
+
@Tag("evaluation-dialog-mode")
public EvaluationMode getEvaluationDialogMode() {
return myEvaluationDialogMode;
@@ -43,4 +45,12 @@ public class XDebuggerGeneralSettings {
public void setUnmuteOnStop(boolean unmuteOnStop) {
myUnmuteOnStop = unmuteOnStop;
}
+
+ public boolean isHideDebuggerOnProcessTermination() {
+ return hideDebuggerOnProcessTermination;
+ }
+
+ public void setHideDebuggerOnProcessTermination(boolean hideDebuggerOnProcessTermination) {
+ this.hideDebuggerOnProcessTermination = hideDebuggerOnProcessTermination;
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
index ae2dcbc4cca1..ad025dfc8d65 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
@@ -16,7 +16,6 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.components.*;
-import com.intellij.openapi.extensions.Extensions;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.AbstractCollection;
@@ -26,12 +25,15 @@ import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.xdebugger.settings.XDebuggerSettings;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import java.util.*;
/**
* @author nik
+ * todo rename to XDebuggerSettingsManagerImpl
*/
+@SuppressWarnings("ClassNameSameAsAncestorName")
@State(
name = XDebuggerSettingsManager.COMPONENT_NAME,
storages = {
@@ -40,26 +42,30 @@ import java.util.*;
)
}
)
-public class XDebuggerSettingsManager implements PersistentStateComponent<XDebuggerSettingsManager.SettingsState>{
+public class XDebuggerSettingsManager extends com.intellij.xdebugger.settings.XDebuggerSettingsManager implements PersistentStateComponent<XDebuggerSettingsManager.SettingsState> {
@NonNls public static final String COMPONENT_NAME = "XDebuggerSettings";
private Map<String, XDebuggerSettings<?>> mySettingsById;
private Map<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>> mySettingsByClass;
private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
- public static XDebuggerSettingsManager getInstance() {
- return ServiceManager.getService(XDebuggerSettingsManager.class);
+ public static XDebuggerSettingsManager getInstanceImpl() {
+ return (XDebuggerSettingsManager)com.intellij.xdebugger.settings.XDebuggerSettingsManager.getInstance();
}
+ @Override
public SettingsState getState() {
SettingsState settingsState = new SettingsState();
settingsState.setDataViewSettings(myDataViewSettings);
settingsState.setGeneralSettings(myGeneralSettings);
for (XDebuggerSettings<?> settings : getSettingsList()) {
- SpecificSettingsState state = new SpecificSettingsState();
- state.setId(settings.getId());
- state.setSettingsElement(XmlSerializer.serialize(settings.getState(), new SkipDefaultValuesSerializationFilters()));
- settingsState.getSpecificStates().add(state);
+ Object subState = settings.getState();
+ if (subState != null) {
+ SpecificSettingsState state = new SpecificSettingsState();
+ state.setId(settings.getId());
+ state.setSettingsElement(XmlSerializer.serialize(subState, new SkipDefaultValuesSerializationFilters()));
+ settingsState.getSpecificStates().add(state);
+ }
}
return settingsState;
}
@@ -69,6 +75,8 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
return Collections.unmodifiableCollection(mySettingsById.values());
}
+ @Override
+ @NotNull
public XDebuggerDataViewSettings getDataViewSettings() {
return myDataViewSettings;
}
@@ -77,6 +85,7 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
return myGeneralSettings;
}
+ @Override
public void loadState(final SettingsState state) {
myDataViewSettings = state.getDataViewSettings();
myGeneralSettings = state.getGeneralSettings();
@@ -95,9 +104,10 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
private void initSettings() {
if (mySettingsById == null) {
- mySettingsById = new HashMap<String, XDebuggerSettings<?>>();
- mySettingsByClass = new HashMap<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>>();
- for (XDebuggerSettings settings : Extensions.getExtensions(XDebuggerSettings.EXTENSION_POINT)) {
+ XDebuggerSettings[] extensions = XDebuggerSettings.EXTENSION_POINT.getExtensions();
+ mySettingsById = new LinkedHashMap<String, XDebuggerSettings<?>>(extensions.length);
+ mySettingsByClass = new LinkedHashMap<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>>(extensions.length);
+ for (XDebuggerSettings settings : extensions) {
mySettingsById.put(settings.getId(), settings);
mySettingsByClass.put(settings.getClass(), settings);
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
index 6dc0a5bc21d9..2e20230198c6 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,26 +16,55 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.project.Project;
+import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
/**
* @author nik
*/
public class XDebuggerSettingsPanelProviderImpl extends DebuggerSettingsPanelProvider {
- public int getPriority() {
- return 0;
- }
-
+ @NotNull
+ @Override
public Collection<? extends Configurable> getConfigurables() {
- ArrayList<Configurable> list = new ArrayList<Configurable>();
- for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstance().getSettingsList()) {
- list.add(settings.createConfigurable());
+ List<Configurable> list = new SmartList<Configurable>();
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ ContainerUtil.addIfNotNull(list, settings.createConfigurable());
}
return list;
}
+ @NotNull
+ @Override
+ public Collection<? extends Configurable> getConfigurable(@NotNull XDebuggerSettings.Category category) {
+ List<Configurable> list;
+ if (category == XDebuggerSettings.Category.ROOT) {
+ list = new SmartList<Configurable>(new GeneralConfigurable());
+ }
+ else {
+ list = null;
+ }
+
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ Configurable configurable = settings.createConfigurable(category);
+ if (configurable != null) {
+ if (list == null) {
+ list = new SmartList<Configurable>();
+ }
+ list.add(configurable);
+ }
+ }
+ return ContainerUtil.notNullize(list);
+ }
+
+ @Override
+ public void generalApplied(@NotNull XDebuggerSettings.Category category) {
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ settings.generalApplied(category);
+ }
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
index 0065a2843aac..853611b62d7d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
@@ -18,6 +18,7 @@ package com.intellij.xdebugger.impl.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.colors.EditorColorsListener;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
@@ -53,6 +54,17 @@ public class ExecutionPointHighlighter {
public ExecutionPointHighlighter(final Project project) {
myProject = project;
+
+ // Update highlighter colors if global color schema was changed
+ final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
+ if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
+ colorsManager.addEditorColorsListener(new EditorColorsListener() {
+ @Override
+ public void globalSchemeChange(EditorColorsScheme scheme) {
+ update();
+ }
+ }, project);
+ }
}
public void show(final @NotNull XSourcePosition position, final boolean useSelection,
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
index afb22607d5d6..d097b09ac3ac 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener;
import com.intellij.ui.DoubleClickListener;
@@ -331,4 +332,23 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
public TransferToEDTQueue<Runnable> getLaterInvocator() {
return myLaterInvocator;
}
+
+ public void expandNodesOnLoad(final Condition<TreeNode> nodeFilter) {
+ addTreeListener(new XDebuggerTreeListener() {
+ @Override
+ public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
+ if (nodeFilter.value(node) && !node.isLeaf()) {
+ // cause children computing
+ node.getChildCount();
+ }
+ }
+
+ @Override
+ public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
+ if (nodeFilter.value(node)) {
+ expandPath(node.getPath());
+ }
+ }
+ });
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
index 00d803d68244..e399dbd96eba 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
@@ -27,12 +27,12 @@ import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
public class SortValuesToggleAction extends ToggleAction implements DumbAware {
@Override
public boolean isSelected(AnActionEvent e) {
- return XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues();
+ return XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings().isSortValues();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
- XDebuggerSettingsManager.getInstance().getDataViewSettings().setSortValues(state);
+ XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings().setSortValues(state);
XDebuggerUtilImpl.rebuildAllSessionsViews(e.getProject());
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
index 38d2547831fe..b9f90fe86b2b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
@@ -21,9 +21,9 @@ import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.SortedList;
import com.intellij.xdebugger.frame.*;
-import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;