diff options
author | Tor Norbye <tnorbye@google.com> | 2013-05-31 07:45:51 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-05-31 07:45:51 -0700 |
commit | ec3fb1e06285c0467a7a20360ca80453bc7635d4 (patch) | |
tree | 2402cdec34611f34b8385ff45387d6734bf6f994 /platform/xdebugger-impl/src | |
parent | a6eac331b3d9f0d4168b12356ea256c83f4e9c05 (diff) | |
download | idea-ec3fb1e06285c0467a7a20360ca80453bc7635d4.tar.gz |
Snapshot 568f05589922685b8c8f9a2f2f465043b8128542 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I47fe8cb5d8a3c9876cd4c313dca1a8cc531288ec
Diffstat (limited to 'platform/xdebugger-impl/src')
17 files changed, 183 insertions, 73 deletions
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 4928340ff8a1..65979b5d7b6d 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -121,11 +121,13 @@ public class XDebugSessionImpl implements XDebugSession { myIcon = icon; } + @Override @NotNull public String getSessionName() { return mySessionName; } + @Override @NotNull public RunContentDescriptor getRunContentDescriptor() { assertSessionTabInitialized(); @@ -141,16 +143,19 @@ public class XDebugSessionImpl implements XDebugSession { } } + @Override public void setPauseActionSupported(final boolean isSupported) { myPauseActionSupported = isSupported; } + @Override public void rebuildViews() { if (!myShowTabOnSuspend) { mySessionTab.rebuildViews(); } } + @Override @Nullable public RunProfile getRunProfile() { return myEnvironment != null ? myEnvironment.getRunProfile() : null; @@ -160,33 +165,40 @@ public class XDebugSessionImpl implements XDebugSession { return myPauseActionSupported; } + @Override @NotNull public Project getProject() { return myDebuggerManager.getProject(); } + @Override @NotNull public XDebugProcess getDebugProcess() { return myDebugProcess; } + @Override public boolean isSuspended() { return myPaused.get() && mySuspendContext != null; } + @Override public boolean isPaused() { return myPaused.get(); } + @Override @Nullable public XStackFrame getCurrentStackFrame() { return myCurrentStackFrame; } + @Override public XSuspendContext getSuspendContext() { return mySuspendContext; } + @Override @Nullable public XSourcePosition getCurrentPosition() { return myCurrentPosition; @@ -208,6 +220,7 @@ public class XDebugSessionImpl implements XDebugSession { dependentBreakpointManager.addListener(myDependentBreakpointListener); myDebugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() { + @Override public void processTerminated(final ProcessEvent event) { stopImpl(); } @@ -337,18 +350,22 @@ public class XDebugSessionImpl implements XDebugSession { return !myBreakpointsMuted && b.isEnabled() && !myDisabledSlaveBreakpoints.contains(b); } + @Override public boolean areBreakpointsMuted() { return myBreakpointsMuted; } + @Override public void addSessionListener(@NotNull final XDebugSessionListener listener) { myDispatcher.addListener(listener); } + @Override public void removeSessionListener(@NotNull final XDebugSessionListener listener) { myDispatcher.removeListener(listener); } + @Override public void setBreakpointMuted(boolean muted) { if (myBreakpointsMuted == muted) return; myBreakpointsMuted = muted; @@ -356,6 +373,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueAllBreakpointsUpdate(); } + @Override public void stepOver(final boolean ignoreBreakpoints) { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -366,6 +384,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebugProcess.startStepOver(); } + @Override public void stepInto() { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -373,6 +392,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebugProcess.startStepInto(); } + @Override public void stepOut() { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -380,6 +400,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebugProcess.startStepOut(); } + @Override public <V extends XSmartStepIntoVariant> void smartStepInto(XSmartStepIntoHandler<V> handler, V variant) { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -387,10 +408,12 @@ public class XDebugSessionImpl implements XDebugSession { handler.startStepInto(variant); } + @Override public void forceStepInto() { stepInto(); } + @Override public void runToPosition(@NotNull final XSourcePosition position, final boolean ignoreBreakpoints) { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -401,6 +424,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebugProcess.runToPosition(position); } + @Override public void pause() { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -418,6 +442,7 @@ public class XDebugSessionImpl implements XDebugSession { processAllBreakpoints(false, true); } + @Override public void resume() { if (!myDebugProcess.checkCanPerformCommands()) return; @@ -457,6 +482,7 @@ public class XDebugSessionImpl implements XDebugSession { } + @Override public void showExecutionPoint() { if (mySuspendContext != null) { XExecutionStack executionStack = mySuspendContext.getActiveExecutionStack(); @@ -470,6 +496,7 @@ public class XDebugSessionImpl implements XDebugSession { } } + @Override public void setCurrentStackFrame(@NotNull final XStackFrame frame) { setCurrentStackFrame(myCurrentExecutionStack, frame); } @@ -517,6 +544,7 @@ public class XDebugSessionImpl implements XDebugSession { return null; } + @Override public void updateBreakpointPresentation(@NotNull final XLineBreakpoint<?> breakpoint, @Nullable final Icon icon, @Nullable final String errorMessage) { @@ -533,10 +561,12 @@ public class XDebugSessionImpl implements XDebugSession { } } + @Override public boolean breakpointReached(@NotNull final XBreakpoint<?> breakpoint, @NotNull final XSuspendContext suspendContext) { return breakpointReached(breakpoint, null, suspendContext); } + @Override public boolean breakpointReached(@NotNull final XBreakpoint<?> breakpoint, @Nullable String evaluatedLogExpression, @NotNull XSuspendContext suspendContext) { XDebuggerEvaluator evaluator = XDebuggerUtilImpl.getEvaluator(suspendContext); @@ -627,6 +657,7 @@ public class XDebugSessionImpl implements XDebugSession { private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) { DebuggerUIUtil.invokeOnEventDispatch(new Runnable() { + @Override public void run() { myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT); if (info != null) { @@ -640,6 +671,7 @@ public class XDebugSessionImpl implements XDebugSession { }); } + @Override public void positionReached(@NotNull final XSuspendContext suspendContext) { enableBreakpoints(); mySuspendContext = suspendContext; @@ -653,6 +685,7 @@ public class XDebugSessionImpl implements XDebugSession { myDebuggerManager.setActiveSession(this, myCurrentPosition, false, getPositionIconRenderer(true)); } UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override public void run() { if (myShowTabOnSuspend) { myShowTabOnSuspend = false; @@ -675,6 +708,7 @@ public class XDebugSessionImpl implements XDebugSession { if (myBreakpointsDisabled) { myBreakpointsDisabled = false; new ReadAction() { + @Override protected void run(final Result result) { processAllBreakpoints(true, false); } @@ -682,6 +716,7 @@ public class XDebugSessionImpl implements XDebugSession { } } + @Override public boolean isStopped() { return myStopped; } @@ -707,6 +742,7 @@ public class XDebugSessionImpl implements XDebugSession { return myDisabledSlaveBreakpoints.contains(breakpoint); } + @Override public void stop() { ProcessHandler processHandler = myDebugProcess.getProcessHandler(); if (processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return; @@ -741,16 +777,19 @@ public class XDebugSessionImpl implements XDebugSession { } private class MyBreakpointListener implements XBreakpointListener<XBreakpoint<?>> { + @Override public void breakpointAdded(@NotNull final XBreakpoint<?> breakpoint) { if (!myBreakpointsDisabled) { processAllHandlers(breakpoint, true); } } + @Override public void breakpointRemoved(@NotNull final XBreakpoint<?> breakpoint) { processAllHandlers(breakpoint, false); } + @Override public void breakpointChanged(@NotNull final XBreakpoint<?> breakpoint) { breakpointRemoved(breakpoint); breakpointAdded(breakpoint); @@ -758,6 +797,7 @@ public class XDebugSessionImpl implements XDebugSession { } private class MyDependentBreakpointListener implements XDependentBreakpointListener { + @Override public void dependencySet(final XBreakpoint<?> slave, final XBreakpoint<?> master) { boolean added = myDisabledSlaveBreakpoints.add(slave); if (added) { @@ -765,6 +805,7 @@ public class XDebugSessionImpl implements XDebugSession { } } + @Override public void dependencyCleared(final XBreakpoint<?> breakpoint) { boolean removed = myDisabledSlaveBreakpoints.remove(breakpoint); if (removed) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java index 086b96dd403c..03adc64be2ad 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java @@ -65,14 +65,14 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid public BreakpointsFavoriteListProvider(Project project) { super(project, "Breakpoints"); myBreakpointPanelProviders = XBreakpointUtil.collectPanelProviders(); - for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) { - provider.addListener(this, myProject, myProject); - provider.createBreakpointsGroupingRules(myRulesAvailable); - } myTreeController = new BreakpointItemsTreeController(myRulesAvailable); myTree = new BreakpointsSimpleTree(myProject, myTreeController); myTreeController.setTreeView(myTree); updateChildren(); + for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) { + provider.addListener(this, myProject, myProject); + provider.createBreakpointsGroupingRules(myRulesAvailable); + } } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/LineBreakpointState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/LineBreakpointState.java index efea6078337e..c698b94fa04f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/LineBreakpointState.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/LineBreakpointState.java @@ -25,8 +25,7 @@ import org.jetbrains.annotations.NotNull; * @author nik */ @Tag("line-breakpoint") -public class LineBreakpointState<P extends XBreakpointProperties> extends - BreakpointState<XLineBreakpoint<P>, P, XLineBreakpointType<P>> { +public class LineBreakpointState<P extends XBreakpointProperties> extends BreakpointState<XLineBreakpoint<P>, P, XLineBreakpointType<P>> { private String myFileUrl; private int myLine; private boolean myTemporary; @@ -67,6 +66,7 @@ public class LineBreakpointState<P extends XBreakpointProperties> extends myTemporary = temporary; } + @Override public XBreakpointBase<XLineBreakpoint<P>,P, ?> createBreakpoint(@NotNull final XLineBreakpointType<P> type, @NotNull XBreakpointManagerImpl breakpointManager) { return new XLineBreakpointImpl<P>(type, breakpointManager, this); } 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 83c94ad22800..c01961ad105b 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 @@ -30,10 +30,7 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.openapi.vfs.*; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.breakpoints.XBreakpointProperties; @@ -107,23 +104,27 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak return VirtualFileManager.getInstance().findFileByUrl(getFileUrl()); } + @Override @NotNull public XLineBreakpointType<P> getType() { return myType; } + @Override public int getLine() { return myState.getLine(); } + @Override public String getFileUrl() { return myState.getFileUrl(); } + @Override public String getPresentableFilePath() { String url = getFileUrl(); if (url != null && LocalFileSystem.PROTOCOL.equals(VirtualFileManager.extractProtocol(url))) { - return FileUtil.toSystemDependentName(VfsUtil.urlToPath(url)); + return FileUtil.toSystemDependentName(VfsUtilCore.urlToPath(url)); } return url != null ? url : ""; } @@ -140,9 +141,11 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak return myHighlighter; } + @Override public XSourcePosition getSourcePosition() { if (mySourcePosition == null) { new ReadAction() { + @Override protected void run(final Result result) { mySourcePosition = XSourcePositionImpl.create(getFile(), getLine()); } @@ -151,10 +154,12 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak return mySourcePosition; } + @Override public boolean isValid() { return myHighlighter != null && myHighlighter.isValid(); } + @Override public void dispose() { removeHighlighter(); myDisposed = true; @@ -170,6 +175,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak @Override protected GutterDraggableObject createBreakpointDraggableObject() { return new GutterDraggableObject() { + @Override public boolean copy(int line, VirtualFile file) { if (canMoveTo(line, file)) { setFileUrl(file.getUrl()); @@ -179,6 +185,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak return false; } + @Override public Cursor getCursor(int line) { return canMoveTo(line, getFile()) ? DragSource.DefaultMoveDrop : DragSource.DefaultMoveNoDrop; } @@ -225,6 +232,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak } } + @Override protected List<? extends AnAction> getAdditionalPopupMenuActions(final XDebugSession session) { return getType().getAdditionalPopupMenuActions(this, session); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java index 2d1a30e9f834..bda64b01f894 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java @@ -106,6 +106,7 @@ public class BreakpointsDialog extends DialogWrapper { setTitle("Breakpoints"); setModal(false); init(); + setOKButtonText("Done"); } private String getSplitterProportionKey() { @@ -171,11 +172,6 @@ public class BreakpointsDialog extends DialogWrapper { return new Action[]{getOKAction()}; } - private static Font smaller(Font f) { - return f.deriveFont(f.getStyle(), f.getSize() - 2); - } - - private class ToggleBreakpointGroupingRuleEnabledAction extends ToggleActionButton { private XBreakpointGroupingRule myRule; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form index a5f353c7518d..af0292479091 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form @@ -59,7 +59,7 @@ <grid row="2" 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 value="&Temporary"/> + <text value="&Remove once hit"/> </properties> </component> </children> 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 c547c2e09074..6be7cd05eaa0 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 @@ -196,7 +196,7 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpoint<?>> implement customPanel.loadFrom(myBreakpoint); } myEnabledCheckbox.setSelected(myBreakpoint.isEnabled()); - myEnabledCheckbox.setText(XBreakpointUtil.getShortText(myBreakpoint)); + myEnabledCheckbox.setText(XBreakpointUtil.getShortText(myBreakpoint) + " enabled"); } public JPanel getMainPanel() { 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 9eedd89fae6f..bfbbf7430a7f 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 @@ -200,7 +200,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper { return myMainPanel; } - public void startEvaluation(XDebuggerEvaluator.XEvaluationCallback evaluationCallback) { + public void startEvaluation(@NotNull XDebuggerEvaluator.XEvaluationCallback evaluationCallback) { final XDebuggerEditorBase inputEditor = myInputComponent.getInputEditor(); inputEditor.saveTextInHistory(); String expression = inputEditor.getText(); 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 6503bc542493..99272e17ef7a 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 @@ -31,10 +31,7 @@ import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; -import com.intellij.xdebugger.frame.XFullValueEvaluator; -import com.intellij.xdebugger.frame.XValue; -import com.intellij.xdebugger.frame.XValueNode; -import com.intellij.xdebugger.frame.XValuePlace; +import com.intellij.xdebugger.frame.*; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint; import com.intellij.xdebugger.impl.evaluate.quick.common.ValueHintType; @@ -43,6 +40,7 @@ import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; import com.intellij.xdebugger.impl.ui.tree.nodes.XEvaluationCallbackBase; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; +import com.intellij.xdebugger.impl.ui.tree.nodes.XValuePresenterAdapter; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -99,16 +97,26 @@ public class XValueHint extends AbstractValueHint { } @Override - public void setGroupingPresentation(@Nullable Icon icon, @NonNls @Nullable String type, boolean expand) { - setPresentation(icon, type, "", "", null, true); + public void setGroupingPresentation(@Nullable Icon icon, @NonNls @Nullable String value, @Nullable XValuePresenter valuePresenter, boolean expand) { + setPresentation(icon, value, valuePresenter, true); + } + + @Override + public void setPresentation(@Nullable Icon icon, @NonNls @Nullable String value, @Nullable XValuePresenter valuePresenter, boolean hasChildren) { + doSetPresentation(icon, null, XDebuggerUIConstants.EQ_TEXT, value, valuePresenter, hasChildren); } @Override public void setPresentation(@Nullable Icon icon, @NonNls @Nullable final String type, @NonNls @NotNull final String separator, @NonNls @NotNull final String value, @Nullable final NotNullFunction<String, String> valuePresenter, final boolean hasChildren) { + doSetPresentation(icon, type, separator, value, valuePresenter == null ? null : new XValuePresenterAdapter(valuePresenter), hasChildren); + } + + private void doSetPresentation(@Nullable Icon icon, @NonNls @Nullable final String type, @NonNls @NotNull final String separator, + @NonNls @Nullable final String value, @Nullable final XValuePresenter valuePresenter, final boolean hasChildren) { DebuggerUIUtil.invokeOnEventDispatch(new Runnable() { public void run() { - doShowHint(result, separator, value, type, valuePresenter != null ? valuePresenter : XValueNodeImpl.DEFAULT_VALUE_PRESENTER, hasChildren); + doShowHint(result, separator, value, type, valuePresenter == null ? XValueNodeImpl.DEFAULT_VALUE_PRESENTER : valuePresenter, hasChildren); } }); } @@ -142,7 +150,7 @@ public class XValueHint extends AbstractValueHint { } private void doShowHint(final XValue xValue, final String separator, final String value, String type, - @NotNull NotNullFunction<String, String> valuePresenter, final boolean hasChildren) { + @NotNull XValuePresenter valuePresenter, final boolean hasChildren) { if (isHintHidden()) return; SimpleColoredText text = new SimpleColoredText(); @@ -151,7 +159,7 @@ public class XValueHint extends AbstractValueHint { if (type != null) { text.append("{" + type + "} ", XDebuggerUIConstants.TYPE_ATTRIBUTES); } - text.append(valuePresenter.fun(value), SimpleTextAttributes.REGULAR_ATTRIBUTES); + valuePresenter.append(value, text, false); if (!hasChildren) { showHint(HintUtil.createInformationLabel(text)); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java index febd85a11b27..240bf070f19c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java @@ -35,7 +35,7 @@ import java.util.List; public abstract class XDebuggerEditorBase { private final Project myProject; private final XDebuggerEditorsProvider myDebuggerEditorsProvider; - private final EvaluationMode myMode; + @NotNull private final EvaluationMode myMode; @Nullable private final String myHistoryId; private final XSourcePosition mySourcePosition; private int myHistoryIndex; @@ -52,6 +52,7 @@ public abstract class XDebuggerEditorBase { mySourcePosition = sourcePosition; } + @NotNull public EvaluationMode getMode() { return myMode; } 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 1420cc2457ac..1da81c865991 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 @@ -213,7 +213,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa } } - public void nodeLoaded(final @NotNull XValueNodeImpl node, final @NotNull String name, final @NotNull String value) { + public void nodeLoaded(final @NotNull XValueNodeImpl node, final @NotNull String name, final @Nullable String value) { for (XDebuggerTreeListener listener : myListeners) { listener.nodeLoaded(node, name, value); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeListener.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeListener.java index 8493eb294347..9a11da7367da 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeListener.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeListener.java @@ -15,10 +15,11 @@ */ package com.intellij.xdebugger.impl.ui.tree; +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 com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -26,8 +27,7 @@ import java.util.List; * @author nik */ public interface XDebuggerTreeListener { - - void nodeLoaded(@NotNull XValueNodeImpl node, final String name, final String value); + void nodeLoaded(@NotNull XValueNodeImpl node, final String name, final @Nullable String value); void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, final boolean last); -} +}
\ No newline at end of file diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java index c5601a42b06e..5a072fe046aa 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java @@ -19,13 +19,14 @@ 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 org.jetbrains.annotations.Nullable; -import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import java.awt.*; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.awt.*; /** * @author nik @@ -61,22 +62,20 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti private void restoreNode(final XDebuggerTreeNode treeNode, final XDebuggerTreeState.NodeInfo parentInfo) { if (treeNode instanceof XValueNodeImpl) { XValueNodeImpl node = (XValueNodeImpl)treeNode; - String nodeName = node.getName(); - String nodeValue = node.getValue(); - if (nodeName == null || nodeValue == null) { - myNode2ParentState.put(node, parentInfo); + if (node.isComputed()) { + doRestoreNode(node, parentInfo, node.getName(), node.getValue()); } else { - doRestoreNode(node, parentInfo, nodeName, nodeValue); + myNode2ParentState.put(node, parentInfo); } } } private void doRestoreNode(final XValueNodeImpl treeNode, final XDebuggerTreeState.NodeInfo parentInfo, final String nodeName, - final String nodeValue) { + final @Nullable String nodeValue) { XDebuggerTreeState.NodeInfo childInfo = parentInfo.removeChild(nodeName); if (childInfo != null) { - if (!childInfo.getValue().equals(nodeValue)) { + if (!(childInfo.getValue() == null ? nodeValue == null : childInfo.getValue().equals(nodeValue))) { treeNode.markChanged(); } if (!myStopRestoringSelection && childInfo.isSelected()) { @@ -93,7 +92,7 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti } } - public void nodeLoaded(@NotNull final XValueNodeImpl node, final String name, final String value) { + public void nodeLoaded(@NotNull final XValueNodeImpl node, final String name, final @Nullable String value) { XDebuggerTreeState.NodeInfo parentInfo = myNode2ParentState.remove(node); if (parentInfo != null) { doRestoreNode(node, parentInfo, name, value); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeState.java index 82a12c76e2d9..bbde1afc97e0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeState.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 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,12 @@ package com.intellij.xdebugger.impl.ui.tree; import com.intellij.openapi.application.ApplicationManager; import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; +import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.tree.TreePath; import java.awt.*; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -80,10 +80,8 @@ public class XDebuggerTreeState { private static NodeInfo createNode(final XDebuggerTreeNode node, boolean selected) { if (node instanceof XValueNodeImpl) { XValueNodeImpl valueNode = (XValueNodeImpl)node; - String name = valueNode.getName(); - String value = valueNode.getValue(); - if (name != null && value != null) { - return new NodeInfo(name, value, selected); + if (valueNode.isComputed()) { + return new NodeInfo(valueNode.getName(), valueNode.getValue(), selected); } } return null; @@ -94,7 +92,7 @@ public class XDebuggerTreeState { private final String myValue; private boolean myExpanded; private final boolean mySelected; - private Map<String, NodeInfo> myChidlren; + private Map<String, NodeInfo> myChildren; public NodeInfo(final String name, final String value, boolean selected) { myName = name; @@ -103,10 +101,10 @@ public class XDebuggerTreeState { } public void addChild(@NotNull NodeInfo child) { - if (myChidlren == null) { - myChidlren = new HashMap<String, NodeInfo>(); + if (myChildren == null) { + myChildren = new THashMap<String, NodeInfo>(); } - myChidlren.put(child.myName, child); + myChildren.put(child.myName, child); } public boolean isExpanded() { @@ -123,7 +121,7 @@ public class XDebuggerTreeState { @Nullable public NodeInfo removeChild(@NotNull String name) { - return myChidlren != null ? myChidlren.remove(name) : null; + return myChildren != null ? myChildren.remove(name) : null; } } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java index e290d97a7c9a..5fc5f992fb3e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java @@ -52,8 +52,7 @@ public abstract class XFetchValueActionBase extends AnAction { for (TreePath path : paths) { Object node = path.getLastPathComponent(); if (node instanceof XValueNodeImpl) { - XValueNodeImpl valueNode = (XValueNodeImpl)node; - if (valueNode.getName() != null && valueNode.getValue() != null) { + if (((XValueNodeImpl)node).isComputed()) { e.getPresentation().setEnabled(true); return; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueNodeImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueNodeImpl.java index 277a96d18b55..801da16e318b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueNodeImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueNodeImpl.java @@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl.ui.tree.nodes; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.SimpleColoredText; import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.NotNullFunction; import com.intellij.xdebugger.frame.*; @@ -41,17 +42,25 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu public static final Comparator<XValueNodeImpl> COMPARATOR = new Comparator<XValueNodeImpl>() { @Override public int compare(XValueNodeImpl o1, XValueNodeImpl o2) { - return StringUtil.compare(o1.getName(), o2.getName(), true); + return StringUtil.naturalCompare(o1.getName(), o2.getName()); } }; - public static final NotNullFunction<String, String> DEFAULT_VALUE_PRESENTER = StringUtil.escaper(false, null); + + public static final XValuePresenter DEFAULT_VALUE_PRESENTER = new StringValuePresenter(-1, null) { + @Override + public void append(String value, SimpleColoredText text, boolean changed) { + doAppend(value, text, changed ? XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES); + } + }; + private String myName; private String myType; + @Nullable private String myValue; private XFullValueEvaluator myFullValueEvaluator; private String mySeparator; private boolean myChanged; - private NotNullFunction<String, String> myValuePresenter; + private XValuePresenter myValuePresenter; public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final @NotNull XValue value) { super(tree, parent, value); @@ -65,13 +74,13 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu } @Override - public void setPresentation(@Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String value, boolean hasChildren) { + public void setPresentation(@Nullable Icon icon, @NonNls @Nullable String type, @NonNls @Nullable String value, boolean hasChildren) { setPresentation(icon, type, XDebuggerUIConstants.EQ_TEXT, value, hasChildren); } @Override public void setPresentation(@Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String separator, - @NonNls @NotNull String value, boolean hasChildren) { + @NonNls @Nullable String value, boolean hasChildren) { setPresentation(null, icon, type, separator, value, hasChildren); } @@ -95,23 +104,28 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu @NonNls @Nullable String type, @NonNls @NotNull String separator, @NonNls @NotNull String value, - @Nullable NotNullFunction<String, String> valuePresenter, + final @Nullable NotNullFunction<String, String> valuePresenter, boolean hasChildren) { - setPresentation(null, icon, type, separator, value, valuePresenter, hasChildren, false); + setPresentation(null, icon, type, separator, value, valuePresenter == null ? null : new XValuePresenterAdapter(valuePresenter), hasChildren, false); } public void setPresentation(@NonNls final String name, @Nullable final Icon icon, @NonNls @Nullable final String type, @NonNls @NotNull final String separator, - @NonNls @NotNull final String value, final boolean hasChildren) { + @NonNls @Nullable final String value, final boolean hasChildren) { setPresentation(name, icon, type, separator, value, null, hasChildren, false); } @Override - public void setGroupingPresentation(@Nullable Icon icon, @NonNls @Nullable String type, boolean expand) { - setPresentation(null, icon, type, "", "", null, true, expand); + public void setGroupingPresentation(@Nullable Icon icon, @NonNls @Nullable String value, @Nullable XValuePresenter valuePresenter, boolean expand) { + setPresentation(null, icon, null, value == null ? "" : XDebuggerUIConstants.EQ_TEXT, value, valuePresenter, true, expand); + } + + @Override + public void setPresentation(@Nullable Icon icon, @NonNls @Nullable String value, @Nullable XValuePresenter valuePresenter, boolean hasChildren) { + setPresentation(null, icon, null, XDebuggerUIConstants.EQ_TEXT, value, valuePresenter, hasChildren, false); } private void setPresentation(@NonNls final String name, @Nullable final Icon icon, @NonNls @Nullable final String type, @NonNls @NotNull final String separator, - @NonNls @NotNull final String value, @Nullable final NotNullFunction<String, String> valuePresenter, final boolean hasChildren, final boolean expand) { + @NonNls @Nullable final String value, @Nullable final XValuePresenter valuePresenter, final boolean hasChildren, final boolean expand) { DebuggerUIUtil.invokeOnEventDispatch(new Runnable() { public void run() { setIcon(icon); @@ -160,13 +174,15 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu } } myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES); - myText.append(mySeparator, SimpleTextAttributes.REGULAR_ATTRIBUTES); + if (!StringUtil.isEmpty(mySeparator)) { + myText.append(mySeparator, SimpleTextAttributes.REGULAR_ATTRIBUTES); + } if (myType != null) { myText.append("{" + myType + "} ", XDebuggerUIConstants.TYPE_ATTRIBUTES); } - - String presentableValue = myValuePresenter.fun(myValue); - myText.append(presentableValue, myChanged ? XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES); + if (myValue != null) { + myValuePresenter.append(myValue, myText, myChanged); + } } public void markChanged() { @@ -219,6 +235,10 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu return myValue; } + public boolean isComputed() { + return myName != null && myValuePresenter != null; + } + public void setValueModificationStarted() { ApplicationManager.getApplication().assertIsDispatchThread(); myValue = null; @@ -229,4 +249,9 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu setLeaf(true); fireNodeStructureChanged(); } -} + + @Override + public String toString() { + return getName(); + } +}
\ No newline at end of file diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValuePresenterAdapter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValuePresenterAdapter.java new file mode 100644 index 000000000000..fa7df03c396f --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValuePresenterAdapter.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2013 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.ui.tree.nodes; + +import com.intellij.ui.SimpleColoredText; +import com.intellij.ui.SimpleTextAttributes; +import com.intellij.util.NotNullFunction; +import com.intellij.xdebugger.frame.XValuePresenter; +import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants; + +public class XValuePresenterAdapter implements XValuePresenter { + private final NotNullFunction<String, String> valuePresenter; + + public XValuePresenterAdapter(NotNullFunction<String, String> valuePresenter) { + this.valuePresenter = valuePresenter; + } + + @Override + public void append(String value, SimpleColoredText text, boolean changed) { + text.append(valuePresenter.fun(value), changed ? XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES); + } +}
\ No newline at end of file |