diff options
Diffstat (limited to 'platform/xdebugger-impl/src/com/intellij/xdebugger/impl')
27 files changed, 385 insertions, 418 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 840163bb9e43..b09c7388748f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java @@ -36,6 +36,7 @@ import org.jetbrains.annotations.Nullable; public abstract class DebuggerSupport { private static final ExtensionPointName<DebuggerSupport> EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.debuggerSupport"); + @SuppressWarnings("deprecation") private static final DebuggerSettingsPanelProvider EMPTY_SETTINGS_PANEL_PROVIDER = new DebuggerSettingsPanelProvider() { }; @@ -60,6 +61,11 @@ public abstract class DebuggerSupport { @NotNull public abstract BreakpointPanelProvider<?> getBreakpointPanelProvider(); + /** + * @deprecated Use {@link com.intellij.xdebugger.settings.DebuggerConfigurableProvider} + */ + @Deprecated + @SuppressWarnings("deprecation") @NotNull public DebuggerSettingsPanelProvider getSettingsPanelProvider() { return EMPTY_SETTINGS_PANEL_PROVIDER; 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 9ab13ba0ae74..762855510a1e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -46,7 +46,6 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.ui.AppUIUtil; @@ -91,7 +90,7 @@ public class XDebugSessionImpl implements XDebugSession { private XDebugProcess myDebugProcess; private final Map<XBreakpoint<?>, CustomizedBreakpointPresentation> myRegisteredBreakpoints = new THashMap<XBreakpoint<?>, CustomizedBreakpointPresentation>(); - private final Set<XBreakpoint<?>> myInactiveSlaveBreakpoints = new SmartHashSet<XBreakpoint<?>>(); + private final Set<XBreakpoint<?>> myInactiveSlaveBreakpoints = Collections.synchronizedSet(new SmartHashSet<XBreakpoint<?>>()); private boolean myBreakpointsDisabled; private final XDebuggerManagerImpl myDebuggerManager; private MyBreakpointListener myBreakpointListener; @@ -103,7 +102,7 @@ public class XDebugSessionImpl implements XDebugSession { private MyDependentBreakpointListener myDependentBreakpointListener; private XValueMarkers<?, ?> myValueMarkers; private final String mySessionName; - private XDebugSessionTab mySessionTab; + private @Nullable XDebugSessionTab mySessionTab; private XDebugSessionData mySessionData; private XBreakpoint<?> myActiveNonLineBreakpoint; private final EventDispatcher<XDebugSessionListener> myDispatcher = EventDispatcher.create(XDebugSessionListener.class); @@ -289,6 +288,7 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void initBreakpoints() { + ApplicationManager.getApplication().assertReadAccessAllowed(); LOG.assertTrue(!breakpointsInitialized); breakpointsInitialized = true; @@ -308,12 +308,14 @@ public class XDebugSessionImpl implements XDebugSession { return myConsoleView; } + @Nullable public XDebugSessionTab getSessionTab() { return mySessionTab; } @Override public RunnerLayoutUi getUI() { + assertSessionTabInitialized(); return mySessionTab.getUi(); } @@ -368,12 +370,7 @@ public class XDebugSessionImpl implements XDebugSession { private <B extends XBreakpoint<?>> void processBreakpoints(final XBreakpointHandler<B> handler, boolean register, final boolean temporary) { - Collection<? extends B> breakpoints = ApplicationManager.getApplication().runReadAction(new Computable<Collection<? extends B>>() { - @Override - public Collection<? extends B> compute() { - return myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); - } - }); + Collection<? extends B> breakpoints = myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); for (B b : breakpoints) { handleBreakpoint(handler, b, register, temporary); } @@ -422,8 +419,9 @@ public class XDebugSessionImpl implements XDebugSession { } } - private boolean isBreakpointActive(final XBreakpoint<?> b) { - return !areBreakpointsMuted() && b.isEnabled() && !myInactiveSlaveBreakpoints.contains(b); + public boolean isBreakpointActive(final XBreakpoint<?> b) { + ApplicationManager.getApplication().assertReadAccessAllowed(); + return !areBreakpointsMuted() && b.isEnabled() && !isInactiveSlaveBreakpoint(b); } @Override @@ -448,6 +446,7 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void setBreakpointMuted(boolean muted) { + ApplicationManager.getApplication().assertReadAccessAllowed(); if (areBreakpointsMuted() == muted) return; mySessionData.setBreakpointsMuted(muted); processAllBreakpoints(!muted, muted); @@ -714,8 +713,10 @@ public class XDebugSessionImpl implements XDebugSession { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - mySessionTab.toFront(); - mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); + if (mySessionTab != null) { + mySessionTab.toFront(true); + mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); + } } }); @@ -847,7 +848,9 @@ public class XDebugSessionImpl implements XDebugSession { if (myStopped) return; myDebugProcess.stop(); - myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + if (!myProject.isDisposed()) { + myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + } myCurrentPosition = null; myCurrentExecutionStack = null; myCurrentStackFrame = null; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java index fbfe184a5f3f..7f8eda2a347f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.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. @@ -26,8 +26,6 @@ import com.intellij.xdebugger.impl.breakpoints.XBreakpointPanelProvider; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; import com.intellij.xdebugger.impl.evaluate.quick.XQuickEvaluateHandler; import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler; -import com.intellij.xdebugger.impl.settings.DebuggerSettingsPanelProvider; -import com.intellij.xdebugger.impl.settings.XDebuggerSettingsPanelProviderImpl; import org.jetbrains.annotations.NotNull; /** @@ -49,7 +47,6 @@ public class XDebuggerSupport extends DebuggerSupport { private final XDebuggerSuspendedActionHandler myShowExecutionPointHandler; private final XDebuggerEvaluateActionHandler myEvaluateHandler; private final XQuickEvaluateHandler myQuickEvaluateHandler; - private final XDebuggerSettingsPanelProviderImpl mySettingsPanelProvider; private final XAddToWatchesFromEditorActionHandler myAddToWatchesActionHandler; private final DebuggerActionHandler myEvaluateInConsoleActionHandler = new XEvaluateInConsoleFromEditorActionHandler(); @@ -118,7 +115,6 @@ public class XDebuggerSupport extends DebuggerSupport { myMuteBreakpointsHandler = new XDebuggerMuteBreakpointsHandler(); myEvaluateHandler = new XDebuggerEvaluateActionHandler(); myQuickEvaluateHandler = new XQuickEvaluateHandler(); - mySettingsPanelProvider = new XDebuggerSettingsPanelProviderImpl(); myMarkObjectActionHandler = new XMarkObjectActionHandler(); myEditBreakpointActionHandler = new XDebuggerEditBreakpointActionHandler(); } @@ -253,10 +249,4 @@ public class XDebuggerSupport extends DebuggerSupport { public EditBreakpointActionHandler getEditBreakpointAction() { return myEditBreakpointActionHandler; } - - @Override - @NotNull - public DebuggerSettingsPanelProvider getSettingsPanelProvider() { - return mySettingsPanelProvider; - } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ForceStepIntoAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ForceStepIntoAction.java index e7c9cae4db92..e5620e20011b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ForceStepIntoAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ForceStepIntoAction.java @@ -15,13 +15,14 @@ */ package com.intellij.xdebugger.impl.actions; -import org.jetbrains.annotations.NotNull; import com.intellij.xdebugger.impl.DebuggerSupport; +import org.jetbrains.annotations.NotNull; /** * @author nik */ public class ForceStepIntoAction extends XDebuggerActionBase { + @Override @NotNull protected DebuggerActionHandler getHandler(@NotNull final DebuggerSupport debuggerSupport) { return debuggerSupport.getForceStepIntoHandler(); 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 364353c2ac63..8631b8fc901b 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 ddf673fe2504..4ee505afec81 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 @@ -62,9 +62,9 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP private final XBreakpointManagerImpl myBreakpointManager; private Icon myIcon; private CustomizedBreakpointPresentation myCustomizedPresentation; - private boolean myConditionEnabled; + private boolean myConditionEnabled = true; private XExpression myCondition; - private boolean myLogExpressionEnabled; + private boolean myLogExpressionEnabled = true; private XExpression myLogExpression; public XBreakpointBase(final XBreakpointType<Self, P> type, XBreakpointManagerImpl breakpointManager, final @Nullable P properties, final S state) { @@ -192,7 +192,6 @@ 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(); @@ -211,7 +210,6 @@ 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(); @@ -226,7 +224,6 @@ 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(); @@ -245,7 +242,6 @@ 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(); 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 6ee8eadbe0ad..36584d1105d4 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 @@ -116,7 +116,7 @@ public class XBreakpointActionsPanel<B extends XBreakpointBase<?,?,?>> extends X if (myLogExpressionComboBox != null) { XExpression expression = myLogExpressionComboBox.getExpression(); XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null; - myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected() && logExpression != null); + myBreakpoint.setLogExpressionEnabled(logExpression == null || myLogExpressionCheckBox.isSelected()); myBreakpoint.setLogExpressionObject(logExpression); myLogExpressionComboBox.saveTextInHistory(); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.form index 64239d330fd1..4ce06a6b52da 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.form +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.form @@ -83,7 +83,7 @@ <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> - <font size="11" style="1"/> + <font style="1"/> <text value="Enabled"/> </properties> </component> 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 0e847d7db05d..75cbb569ddfd 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 @@ -208,7 +208,7 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i if (myConditionComboBox != null) { XExpression expression = myConditionComboBox.getExpression(); XExpression condition = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null; - myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected() && condition != null); + myBreakpoint.setConditionEnabled(condition == null || myConditionEnabledCheckbox.isSelected()); myBreakpoint.setConditionExpression(condition); myConditionComboBox.saveTextInHistory(); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/grouping/XBreakpointFileGroupingRule.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/grouping/XBreakpointFileGroupingRule.java index b0b5998ef71f..994e51f2bbc4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/grouping/XBreakpointFileGroupingRule.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/grouping/XBreakpointFileGroupingRule.java @@ -62,6 +62,6 @@ public class XBreakpointFileGroupingRule<B> extends XBreakpointGroupingRule<B, X @Nullable @Override public Icon getIcon() { - return AllIcons.FileTypes.Text; + return AllIcons.Actions.GroupByFile; } } 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 2273ab698768..bee9b3d91fd7 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 @@ -33,6 +33,7 @@ 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.XDebugSessionTab; import com.intellij.xdebugger.impl.ui.XDebuggerEditorBase; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel; @@ -138,7 +139,11 @@ public class XDebuggerEvaluationDialog extends DialogWrapper { // add to watches XExpression expression = myInputComponent.getInputEditor().getExpression(); if (!XDebuggerUtilImpl.isEmptyExpression(expression)) { - ((XDebugSessionImpl)mySession).getSessionTab().getWatchesView().addWatchExpression(expression, -1, false); + XDebugSessionTab tab = ((XDebugSessionImpl)mySession).getSessionTab(); + if (tab != null) { + tab.getWatchesView().addWatchExpression(expression, -1, true); + requestFocusInEditor(); + } } } } @@ -195,7 +200,11 @@ public class XDebuggerEvaluationDialog extends DialogWrapper { setTitle(myInputComponent.getTitle()); mySwitchModeAction.putValue(Action.NAME, getSwitchButtonText(mode)); - final JComponent preferredFocusedComponent = myInputComponent.getInputEditor().getPreferredFocusedComponent(); + requestFocusInEditor(); + } + + private void requestFocusInEditor() { + JComponent preferredFocusedComponent = myInputComponent.getInputEditor().getPreferredFocusedComponent(); if (preferredFocusedComponent != null) { IdeFocusManager.getInstance(mySession.getProject()).requestFocus(preferredFocusedComponent, true); } 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 bf3e0010e6cf..0ccd488e9f9b 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 @@ -100,14 +100,7 @@ public class XQuickEvaluateHandler extends QuickEvaluateHandler { } @Override - public int getValueLookupDelay(final Project project) { - XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); - if (session != null) { - XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator(); - if (evaluator != null) { - return evaluator.getValuePopupDelay(); - } - } + public int getValueLookupDelay(Project project) { return XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay(); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java index cdfcad27354c..ca78932701d2 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java @@ -104,6 +104,7 @@ public class XValueHint extends AbstractValueHint { public void evaluated(@NotNull final XValue result) { result.computePresentation(new XValueNodePresentationConfigurator.ConfigurableXValueNodeImpl() { private XFullValueEvaluator myFullValueEvaluator; + private boolean myShown = false; @Override public void applyPresentation(@Nullable Icon icon, @@ -131,7 +132,7 @@ public class XValueHint extends AbstractValueHint { } showHint(component); } - else if (getType() == ValueHintType.MOUSE_CLICK_HINT) { + else if (getType() == ValueHintType.MOUSE_CLICK_HINT && !myShown) { showTree(result); } else { @@ -143,6 +144,7 @@ public class XValueHint extends AbstractValueHint { }); showHint(component); } + myShown = true; } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java index 5183877b2a9a..6216c1312349 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java @@ -15,6 +15,8 @@ */ package com.intellij.xdebugger.impl.frame; +import com.intellij.debugger.ui.DebuggerContentInfo; +import com.intellij.execution.ui.layout.impl.RunnerContentUi; import com.intellij.ide.DataManager; import com.intellij.ide.dnd.DnDEvent; import com.intellij.ide.dnd.DnDManager; @@ -22,6 +24,7 @@ import com.intellij.ide.dnd.DnDNativeTarget; import com.intellij.openapi.CompositeDisposable; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.util.SystemInfo; @@ -36,6 +39,7 @@ import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.impl.XDebugSessionImpl; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; +import com.intellij.xdebugger.impl.ui.XDebugSessionTab; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeRestorer; @@ -68,6 +72,7 @@ public class XWatchesViewImpl implements DnDNativeTarget, XWatchesView, XDebugVi @NotNull private final XDebugSessionImpl mySession; private final JPanel myDecoratedPanel; private final CompositeDisposable myDisposables = new CompositeDisposable(); + private boolean myRebuildNeeded; public XWatchesViewImpl(@NotNull final XDebugSessionImpl session) { mySession = session; @@ -216,10 +221,40 @@ public class XWatchesViewImpl implements DnDNativeTarget, XWatchesView, XDebugVi public void addWatchExpression(@NotNull XExpression expression, int index, final boolean navigateToWatchNode) { myRootNode.addWatchExpression(mySession.getDebugProcess().getEvaluator(), expression, index, navigateToWatchNode); updateSessionData(); + if (navigateToWatchNode) { + showWatchesTab(); + } + } + + private void showWatchesTab() { + XDebugSessionTab tab = mySession.getSessionTab(); + if (tab != null) { + tab.toFront(false); + // restore watches tab if minimized + JComponent component = tab.getUi().getComponent(); + if (component instanceof DataProvider) { + RunnerContentUi ui = RunnerContentUi.KEY.getData(((DataProvider)component)); + if (ui != null) { + ui.restoreContent(DebuggerContentInfo.WATCHES_CONTENT); + } + } + } + } + + public boolean rebuildNeeded() { + return myRebuildNeeded; } @Override public void processSessionEvent(@NotNull final SessionEvent event) { + if (getMainPanel().isShowing() || ApplicationManager.getApplication().isUnitTestMode()) { + myRebuildNeeded = false; + } + else { + myRebuildNeeded = true; + return; + } + XStackFrame stackFrame = mySession.getCurrentStackFrame(); XDebuggerTree tree = myTreePanel.getTree(); 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 index d140a74f35c8..6ee307cfa573 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java @@ -17,7 +17,7 @@ package com.intellij.xdebugger.impl.settings; import com.intellij.openapi.options.Configurable; import com.intellij.xdebugger.XDebuggerBundle; -import com.intellij.xdebugger.settings.XDebuggerSettings; +import com.intellij.xdebugger.settings.DebuggerSettingsCategory; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -41,8 +41,8 @@ class DataViewsConfigurable extends SubCompositeConfigurable implements Configur @NotNull @Override - protected XDebuggerSettings.Category getCategory() { - return XDebuggerSettings.Category.DATA_VIEWS; + protected DebuggerSettingsCategory getCategory() { + return DebuggerSettingsCategory.DATA_VIEWS; } @NotNull 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 a3f4e847288c..58896a87f596 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 @@ -20,26 +20,23 @@ 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.util.containers.ContainerUtil; import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.impl.DebuggerSupport; -import com.intellij.xdebugger.settings.XDebuggerSettings; -import org.jetbrains.annotations.Nls; +import com.intellij.xdebugger.settings.DebuggerConfigurableProvider; +import com.intellij.xdebugger.settings.DebuggerSettingsCategory; 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; +import java.util.*; -/** - * @author Eugene Belyaev & Eugene Zhuravlev - */ 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 static final DebuggerSettingsCategory[] MERGED_CATEGORIES = {DebuggerSettingsCategory.STEPPING, DebuggerSettingsCategory.HOTSWAP}; private Configurable myRootConfigurable; private Configurable[] myChildren; @@ -71,89 +68,84 @@ public class DebuggerConfigurable implements SearchableConfigurable.Parent { 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)); + DebuggerConfigurableProvider[] providers = DebuggerConfigurableProvider.EXTENSION_POINT.getExtensions(); + computeMergedConfigurables(providers, configurables); + + //noinspection deprecation + for (DebuggerSettingsPanelProvider provider : getSortedProviders()) { + configurables.addAll(provider.getConfigurables()); + @SuppressWarnings("deprecation") + Configurable providerRootConfigurable = provider.getRootConfigurable(); + if (providerRootConfigurable != null) { + configurables.add(providerRootConfigurable); + } } - Configurable rootConfigurable = computeRootConfigurable(providers, configurables); + for (DebuggerConfigurableProvider provider : providers) { + configurables.addAll(provider.getConfigurables(DebuggerSettingsCategory.ROOT)); + } - if (configurables.isEmpty() && rootConfigurable == null) { + MergedCompositeConfigurable mergedGeneralConfigurable = computeGeneralConfigurables(providers); + if (configurables.isEmpty() && mergedGeneralConfigurable == null) { + myRootConfigurable = null; myChildren = EMPTY_CONFIGURABLES; } - else if (rootConfigurable == null && configurables.size() == 1) { - myRootConfigurable = configurables.get(0); - myChildren = EMPTY_CONFIGURABLES; + else if (configurables.size() == 1) { + Configurable firstConfigurable = configurables.get(0); + if (mergedGeneralConfigurable == null) { + myRootConfigurable = firstConfigurable; + myChildren = EMPTY_CONFIGURABLES; + } + else { + Configurable[] generalConfigurables = mergedGeneralConfigurable.children; + Configurable[] mergedArray = new Configurable[generalConfigurables.length + 1]; + System.arraycopy(generalConfigurables, 0, mergedArray, 0, generalConfigurables.length); + mergedArray[generalConfigurables.length] = firstConfigurable; + myRootConfigurable = new MergedCompositeConfigurable("", "", mergedArray); + myChildren = firstConfigurable instanceof SearchableConfigurable.Parent ? ((Parent)firstConfigurable).getConfigurables() : EMPTY_CONFIGURABLES; + } } else { myChildren = configurables.toArray(new Configurable[configurables.size()]); - myRootConfigurable = rootConfigurable; + myRootConfigurable = mergedGeneralConfigurable; } } - @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); - } + private static void computeMergedConfigurables(@NotNull DebuggerConfigurableProvider[] providers, @NotNull List<Configurable> result) { + for (DebuggerSettingsCategory category : MERGED_CATEGORIES) { + List<Configurable> configurables = getConfigurables(category, providers); + if (!configurables.isEmpty()) { + String id = category.name().toLowerCase(Locale.ENGLISH); + result.add(new MergedCompositeConfigurable("debugger." + id, XDebuggerBundle.message("debugger." + id + ".display.name"), + configurables.toArray(new Configurable[configurables.size()]))); } } + } - List<Configurable> rootConfigurables = DebuggerConfigurableProvider.getConfigurables(XDebuggerSettings.Category.ROOT, providers); + @Nullable + private static MergedCompositeConfigurable computeGeneralConfigurables(@NotNull DebuggerConfigurableProvider[] providers) { + List<Configurable> rootConfigurables = getConfigurables(DebuggerSettingsCategory.GENERAL, providers); if (rootConfigurables.isEmpty()) { - return deprecatedRootConfigurable; + return null; } - 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(); - } - }; - } + Configurable[] mergedRootConfigurables = rootConfigurables.toArray(new Configurable[rootConfigurables.size()]); + // move unnamed to top + Arrays.sort(mergedRootConfigurables, new Comparator<Configurable>() { + @Override + public int compare(@NotNull Configurable o1, @NotNull Configurable o2) { + boolean c1e = StringUtil.isEmpty(o1.getDisplayName()); + return c1e == StringUtil.isEmpty(o2.getDisplayName()) ? 0 : (c1e ? -1 : 1); + } + }); + return new MergedCompositeConfigurable("", "", mergedRootConfigurables); } @Override public void apply() throws ConfigurationException { - for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) { - support.getSettingsPanelProvider().apply(); - } if (myRootConfigurable != null) { myRootConfigurable.apply(); } @@ -206,4 +198,51 @@ public class DebuggerConfigurable implements SearchableConfigurable.Parent { public String getId() { return "project.propDebugger"; } + + @SuppressWarnings("deprecation") + @NotNull + private 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(@NotNull DebuggerSettingsPanelProvider o1, @NotNull DebuggerSettingsPanelProvider o2) { + return o2.getPriority() - o1.getPriority(); + } + }); + } + return providers; + } + + @NotNull + static List<Configurable> getConfigurables(@NotNull DebuggerSettingsCategory category) { + return getConfigurables(category, DebuggerConfigurableProvider.EXTENSION_POINT.getExtensions()); + } + + @NotNull + private static List<Configurable> getConfigurables(@NotNull DebuggerSettingsCategory category, @NotNull DebuggerConfigurableProvider[] providers) { + List<Configurable> configurables = null; + for (DebuggerConfigurableProvider provider : providers) { + Collection<? extends Configurable> providerConfigurables = provider.getConfigurables(category); + if (!providerConfigurables.isEmpty()) { + if (configurables == null) { + configurables = new SmartList<Configurable>(); + } + configurables.addAll(providerConfigurables); + } + } + return ContainerUtil.notNullize(configurables); + } } 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 deleted file mode 100644 index 80651cadc830..000000000000 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2000-2010 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.ConfigurableProvider; -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.Collection; -import java.util.Collections; -import java.util.Comparator; -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() { - return new DebuggerConfigurable(); - } - - @NotNull - static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category) { - List<DebuggerSettingsPanelProvider> providers = getSortedProviders(); - return providers.isEmpty() ? Collections.<Configurable>emptyList() : getConfigurables(category, providers); - } - - @NotNull - static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category, @NotNull List<DebuggerSettingsPanelProvider> providers) { - List<Configurable> configurables = null; - for (DebuggerSettingsPanelProvider provider : providers) { - Collection<? extends Configurable> providerConfigurables = provider.getConfigurable(category); - if (!providerConfigurables.isEmpty()) { - if (configurables == null) { - configurables = new SmartList<Configurable>(); - } - configurables.addAll(providerConfigurables); - } - } - 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 68e6de064b9a..5b0dde609e0c 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 @@ -16,15 +16,15 @@ 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; +@Deprecated /** - * @author nik + * @deprecated Use {@link com.intellij.xdebugger.settings.DebuggerConfigurableProvider} */ public abstract class DebuggerSettingsPanelProvider { public int getPriority() { @@ -36,23 +36,20 @@ public abstract class DebuggerSettingsPanelProvider { return Collections.emptyList(); } + @Deprecated + /** + * @deprecated Please use {@link com.intellij.xdebugger.settings.DebuggerConfigurableProvider#generalApplied(com.intellij.xdebugger.settings.DebuggerSettingsCategory)} + */ 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 + * @deprecated Please use {@link com.intellij.xdebugger.settings.DebuggerConfigurableProvider#getConfigurables(com.intellij.xdebugger.settings.DebuggerSettingsCategory)} and + * check {@link com.intellij.xdebugger.settings.DebuggerSettingsCategory#GENERAL} */ - public void generalApplied(@NotNull XDebuggerSettings.Category category) { + public Configurable getRootConfigurable() { + return null; } } 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 deleted file mode 100644 index 466279bce977..000000000000 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/MergedCompositeConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java index be0bdbf0ab2f..ccfc2708cb9e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java @@ -7,6 +7,8 @@ import com.intellij.openapi.ui.VerticalFlowLayout; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.TitledSeparator; +import com.intellij.xdebugger.settings.DebuggerConfigurableProvider; +import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,18 +16,34 @@ import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; -abstract class MergedCompositeConfigurable implements SearchableConfigurable { +class MergedCompositeConfigurable implements SearchableConfigurable { static final EmptyBorder BOTTOM_INSETS = new EmptyBorder(0, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0); + private static final Insets FIRST_COMPONENT_INSETS = new Insets(0, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0); + private static final Insets N_COMPONENT_INSETS = new Insets(IdeBorderFactory.TITLED_BORDER_TOP_INSET, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0); + protected final Configurable[] children; protected JComponent rootComponent; - protected MergedCompositeConfigurable(@NotNull Configurable[] children) { + private final String id; + private final String displayName; + + public MergedCompositeConfigurable(@NotNull String id, @NotNull String displayName, @NotNull Configurable[] children) { this.children = children; + this.id = id; + this.displayName = displayName; } - protected boolean isUseTitledBorder() { - return true; + @NotNull + @Override + public String getId() { + return id; + } + + @Nls + @Override + public String getDisplayName() { + return displayName; } @Nullable @@ -40,26 +58,47 @@ abstract class MergedCompositeConfigurable implements SearchableConfigurable { return children.length == 1 ? children[0].getHelpTopic() : null; } + /** + * false by default. + * + * If Ruby general settings will be without titled border in RubyMine, user could think that all other debugger categories also about Ruby. + */ + protected boolean isUseTargetedProductPolicyIfSeveralChildren() { + return false; + } + @Nullable @Override public JComponent createComponent() { if (rootComponent == null) { + Configurable firstConfigurable = children[0]; if (children.length == 1) { - rootComponent = children[0].createComponent(); + rootComponent = firstConfigurable.createComponent(); + String rootComponentDisplayName = firstConfigurable.getDisplayName(); + if (!StringUtil.isEmpty(rootComponentDisplayName) && !isTargetedToProduct(firstConfigurable)) { + rootComponent.setBorder(IdeBorderFactory.createTitledBorder(rootComponentDisplayName, false, FIRST_COMPONENT_INSETS)); + } } else { - JPanel panel = createPanel(isUseTitledBorder()); - for (Configurable child : children) { - JComponent component = child.createComponent(); + boolean isFirstNamed = true; + JPanel panel = createPanel(true); + for (Configurable configurable : children) { + JComponent component = configurable.createComponent(); assert component != null; - if (isUseTitledBorder()) { - String displayName = child.getDisplayName(); - if (StringUtil.isEmpty(displayName)) { - component.setBorder(BOTTOM_INSETS); + String displayName = configurable.getDisplayName(); + if (StringUtil.isEmpty(displayName)) { + component.setBorder(BOTTOM_INSETS); + } + else { + boolean addBorder = true; + if (isUseTargetedProductPolicyIfSeveralChildren() && isFirstNamed) { + isFirstNamed = false; + if (isTargetedToProduct(configurable)) { + addBorder = false; + } } - 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)); + if (addBorder) { + component.setBorder(IdeBorderFactory.createTitledBorder(displayName, false, firstConfigurable == configurable ? FIRST_COMPONENT_INSETS : N_COMPONENT_INSETS)); } } panel.add(component); @@ -70,6 +109,15 @@ abstract class MergedCompositeConfigurable implements SearchableConfigurable { return rootComponent; } + static boolean isTargetedToProduct(@NotNull Configurable configurable) { + for (DebuggerConfigurableProvider provider : DebuggerConfigurableProvider.EXTENSION_POINT.getExtensions()) { + if (provider.isTargetedToProduct(configurable)) { + return true; + } + } + return false; + } + @NotNull static JPanel createPanel(boolean isUseTitledBorder) { int verticalGap = TitledSeparator.TOP_INSET; 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 deleted file mode 100644 index 5f16424c1790..000000000000 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 index 489e4bd80307..f06b6bcc1107 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java @@ -20,8 +20,8 @@ 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 com.intellij.xdebugger.settings.DebuggerConfigurableProvider; +import com.intellij.xdebugger.settings.DebuggerSettingsCategory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -77,7 +77,7 @@ abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent protected abstract DataViewsConfigurableUi createRootUi(); @NotNull - protected abstract XDebuggerSettings.Category getCategory(); + protected abstract DebuggerSettingsCategory getCategory(); private boolean isChildrenMerged() { return children != null && children.length == 1; @@ -86,7 +86,7 @@ abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent @Override public final Configurable[] getConfigurables() { if (children == null) { - List<Configurable> configurables = DebuggerConfigurableProvider.getConfigurables(getCategory()); + List<Configurable> configurables = DebuggerConfigurable.getConfigurables(getCategory()); children = configurables.toArray(new Configurable[configurables.size()]); } return isChildrenMerged() ? DebuggerConfigurable.EMPTY_CONFIGURABLES : children; @@ -115,10 +115,12 @@ abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent c.setBorder(MergedCompositeConfigurable.BOTTOM_INSETS); panel.add(c); } - for (Configurable child : children) { - JComponent component = child.createComponent(); + for (Configurable configurable : children) { + JComponent component = configurable.createComponent(); if (component != null) { - component.setBorder(IdeBorderFactory.createTitledBorder(child.getDisplayName(), false)); + if (children[0] != configurable || !MergedCompositeConfigurable.isTargetedToProduct(configurable)) { + component.setBorder(IdeBorderFactory.createTitledBorder(configurable.getDisplayName(), false)); + } panel.add(component); } } @@ -164,8 +166,8 @@ abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent public final void apply() throws ConfigurationException { if (root != null) { root.apply(getSettings()); - for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) { - support.getSettingsPanelProvider().generalApplied(getCategory()); + for (DebuggerConfigurableProvider provider : DebuggerConfigurableProvider.EXTENSION_POINT.getExtensions()) { + provider.generalApplied(getCategory()); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerConfigurableProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerConfigurableProvider.java new file mode 100644 index 000000000000..2a7f636784c4 --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerConfigurableProvider.java @@ -0,0 +1,74 @@ +package com.intellij.xdebugger.impl.settings; + +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.SimpleConfigurable; +import com.intellij.openapi.util.Getter; +import com.intellij.util.SmartList; +import com.intellij.util.containers.ContainerUtil; +import com.intellij.xdebugger.settings.DebuggerConfigurableProvider; +import com.intellij.xdebugger.settings.DebuggerSettingsCategory; +import com.intellij.xdebugger.settings.XDebuggerSettings; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.List; + +class XDebuggerConfigurableProvider extends DebuggerConfigurableProvider { + @NotNull + @Override + public Collection<? extends Configurable> getConfigurables(@NotNull DebuggerSettingsCategory category) { + List<Configurable> list; + if (category == DebuggerSettingsCategory.GENERAL) { + list = new SmartList<Configurable>(SimpleConfigurable.create("debugger.general", "", GeneralConfigurableUi.class, new Getter<XDebuggerGeneralSettings>() { + @Override + public XDebuggerGeneralSettings get() { + return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings(); + } + })); + } + else { + list = null; + } + + for (XDebuggerSettings<?> settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) { + Collection<? extends Configurable> configurables = settings.createConfigurables(category); + if (!configurables.isEmpty()) { + if (list == null) { + list = new SmartList<Configurable>(); + } + list.addAll(configurables); + } + } + + if (category == DebuggerSettingsCategory.ROOT) { + for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) { + @SuppressWarnings("deprecation") + Configurable configurable = settings.createConfigurable(); + if (configurable != null) { + if (list == null) { + list = new SmartList<Configurable>(); + } + list.add(configurable); + } + } + } + return ContainerUtil.notNullize(list); + } + + @Override + public void generalApplied(@NotNull DebuggerSettingsCategory category) { + for (XDebuggerSettings<?> settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) { + settings.generalApplied(category); + } + } + + @Override + public boolean isTargetedToProduct(@NotNull Configurable configurable) { + for (XDebuggerSettings<?> settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) { + if (settings.isTargetedToProduct(configurable)) { + return true; + } + } + return super.isTargetedToProduct(configurable); + } +}
\ No newline at end of file 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 deleted file mode 100644 index 2e20230198c6..000000000000 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.util.SmartList; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.xdebugger.settings.XDebuggerSettings; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; -import java.util.List; - -/** - * @author nik - */ -public class XDebuggerSettingsPanelProviderImpl extends DebuggerSettingsPanelProvider { - @NotNull - @Override - public Collection<? extends Configurable> getConfigurables() { - 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/DebuggerSessionTabBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java index 57b2e9d505e1..2134c0c8d4e1 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java @@ -151,19 +151,21 @@ public abstract class DebuggerSessionTabBase extends LogConsoleManagerBase imple return environment != null ? environment.getRunProfile() : null; } - public void toFront() { + public void toFront(boolean focus) { if (!ApplicationManager.getApplication().isUnitTestMode()) { ExecutionManager.getInstance(getProject()).getContentManager().toFrontRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor); - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - boolean focusWnd = Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"); - ProjectUtil.focusProjectWindow(getProject(), focusWnd); - if (!focusWnd) { - AppIcon.getInstance().requestAttention(getProject(), true); + if (focus) { + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + boolean focusWnd = Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"); + ProjectUtil.focusProjectWindow(getProject(), focusWnd); + if (!focusWnd) { + AppIcon.getInstance().requestAttention(getProject(), true); + } } - } - }); + }); + } } } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java index 2e5f8a337385..4b6bea217c54 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java @@ -27,6 +27,7 @@ import com.intellij.execution.ui.ExecutionConsole; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.execution.ui.actions.CloseAction; import com.intellij.execution.ui.layout.PlaceInGrid; +import com.intellij.execution.ui.layout.impl.ViewImpl; import com.intellij.icons.AllIcons; import com.intellij.ide.actions.ContextHelpAction; import com.intellij.idea.ActionsBundle; @@ -37,6 +38,8 @@ import com.intellij.openapi.util.Disposer; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.ui.AppUIUtil; import com.intellij.ui.content.Content; +import com.intellij.ui.content.ContentManagerAdapter; +import com.intellij.ui.content.ContentManagerEvent; import com.intellij.ui.content.tabs.PinToolwindowTabAction; import com.intellij.xdebugger.XDebugProcess; import com.intellij.xdebugger.XDebugSession; @@ -242,6 +245,18 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { focus.add(ActionManager.getInstance().getAction(XDebuggerActions.FOCUS_ON_BREAKPOINT)); myUi.getOptions().setAdditionalFocusActions(focus); + myUi.addListener(new ContentManagerAdapter() { + @Override + public void selectionChanged(ContentManagerEvent event) { + Content content = event.getContent(); + if (content.isSelected() && DebuggerContentInfo.WATCHES_CONTENT.equals(content.getUserData(ViewImpl.ID))) { + if (myWatchesView.rebuildNeeded()) { + myWatchesView.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED); + } + } + } + }, this); + rebuildViews(); } 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 d097b09ac3ac..fe32920a7ac6 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 @@ -35,10 +35,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.frame.XDebuggerTreeNodeHyperlink; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.intellij.xdebugger.impl.frame.XValueMarkers; -import com.intellij.xdebugger.impl.ui.tree.nodes.MessageTreeNode; -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.*; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -254,6 +251,12 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa if (XDEBUGGER_TREE_KEY.is(dataId)) { return this; } + if (PlatformDataKeys.PREDEFINED_TEXT.is(dataId)) { + XValueNodeImpl[] selectedNodes = getSelectedNodes(XValueNodeImpl.class, null); + if (selectedNodes.length == 1 && selectedNodes[0].getFullValueEvaluator() == null) { + return selectedNodes[0].getRawValue(); + } + } return null; } |