diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerActions.java b/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerActions.java index 6b5eadf8ff34..ca323d4ad528 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerActions.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerActions.java @@ -37,7 +37,6 @@ public interface DebuggerActions extends XDebuggerActions { @NonNls String REMOVE_WATCH = "Debugger.RemoveWatch"; @NonNls String NEW_WATCH = "Debugger.NewWatch"; @NonNls String EDIT_WATCH = "Debugger.EditWatch"; - @NonNls String MARK_OBJECT = "Debugger.MarkObject"; @NonNls String COPY_VALUE = "Debugger.CopyValue"; @NonNls String SET_VALUE = "Debugger.SetValue"; @NonNls String EDIT_FRAME_SOURCE = "Debugger.EditFrameSource"; diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/MarkObjectAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaMarkObjectActionHandler.java similarity index 86% rename from java/debugger/impl/src/com/intellij/debugger/actions/MarkObjectAction.java rename to java/debugger/impl/src/com/intellij/debugger/actions/JavaMarkObjectActionHandler.java index 37b129cd385f..18e54211dc45 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/MarkObjectAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JavaMarkObjectActionHandler.java @@ -16,6 +16,7 @@ package com.intellij.debugger.actions; import com.intellij.codeInsight.daemon.impl.HighlightInfoType; +import com.intellij.debugger.engine.DebugProcess; import com.intellij.debugger.engine.DebugProcessImpl; import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.debugger.engine.events.DebuggerContextCommandImpl; @@ -26,17 +27,18 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl; import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl; import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl; import com.intellij.debugger.ui.tree.ValueDescriptor; -import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; -import com.intellij.idea.ActionsBundle; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.markup.TextAttributes; +import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.util.containers.HashMap; +import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; import com.sun.jdi.*; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -51,14 +53,13 @@ import java.util.Map; * Class SetValueAction * @author Jeka */ -public class MarkObjectAction extends DebuggerAction { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.actions.MarkObjectAction"); +public class JavaMarkObjectActionHandler extends MarkObjectActionHandler { + private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.actions.JavaMarkObjectActionHandler"); public static final long AUTO_MARKUP_REFERRING_OBJECTS_LIMIT = 100L; // todo: some reasonable limit - private final String MARK_TEXT = ActionsBundle.message("action.Debugger.MarkObject.text"); - private final String UNMARK_TEXT = ActionsBundle.message("action.Debugger.MarkObject.unmark.text"); - public void actionPerformed(final AnActionEvent event) { - final DebuggerTreeNodeImpl node = getSelectedNode(event.getDataContext()); + @Override + public void perform(@NotNull Project project, AnActionEvent event) { + final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext()); if (node == null) { return; } @@ -233,24 +234,27 @@ public class MarkObjectAction extends DebuggerAction { return builder.append("
").append(refType.name()).append(".").append(fieldName).append("").toString(); } + @Override + public boolean isEnabled(@NotNull Project project, AnActionEvent event) { + final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext()); + return node != null && node.getDescriptor() instanceof ValueDescriptor; + } - public void update(AnActionEvent e) { - boolean enable = false; - String text = MARK_TEXT; - final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext()); - if (node != null) { - final NodeDescriptorImpl descriptor = node.getDescriptor(); - enable = (descriptor instanceof ValueDescriptor); - if (enable) { - final ValueMarkup markup = ((ValueDescriptor)descriptor).getMarkup(node.getTree().getDebuggerContext().getDebugProcess()); - if (markup != null) { // already exists - text = UNMARK_TEXT; - } - } - } - final Presentation presentation = e.getPresentation(); - presentation.setVisible(enable); - presentation.setText(text); + @Override + public boolean isHidden(@NotNull Project project, AnActionEvent event) { + return DebuggerAction.getSelectedNode(event.getDataContext()) == null; + } + + @Override + public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) { + final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext()); + if (node == null) return false; + + final NodeDescriptorImpl descriptor = node.getDescriptor(); + if (!(descriptor instanceof ValueDescriptor)) return false; + + DebugProcess debugProcess = node.getTree().getDebuggerContext().getDebugProcess(); + return ((ValueDescriptor)descriptor).getMarkup(debugProcess) != null; } public static Color getAutoMarkupColor() { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java b/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java index 15ef421bdea1..fe2ac9ee5bf5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java @@ -17,7 +17,7 @@ package com.intellij.debugger.actions; import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.ui.ex.MultiLineLabel; -import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialogBase; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -28,7 +28,7 @@ import java.awt.*; * @author Eugene Zhuravlev * Date: Feb 4, 2007 */ -public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialog { +public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialogBase { @NonNls private static final String MARK_ALL_REFERENCED_VALUES_KEY = "debugger.mark.all.referenced.values"; private JCheckBox myCbMarkAdditionalFields; private final boolean mySuggestAdditionalMarkup; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java index 76d5a6985672..71646e033b74 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java @@ -29,8 +29,8 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.xdebugger.AbstractDebuggerSession; import com.intellij.xdebugger.impl.DebuggerSupport; -import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; -import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler; +import com.intellij.xdebugger.impl.actions.*; +import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler; import com.intellij.xdebugger.impl.breakpoints.ui.AbstractBreakpointPanel; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler; @@ -63,6 +63,7 @@ public class JavaDebuggerSupport extends DebuggerSupport { private final MuteBreakpointsActionHandler myMuteBreakpointsHandler = new MuteBreakpointsActionHandler(); private final DebuggerActionHandler mySmartStepIntoHandler = new SmartStepIntoActionHandler(); private final DebuggerActionHandler myAddToWatchedActionHandler = new AddToWatchActionHandler(); + private JavaMarkObjectActionHandler myMarkObjectActionHandler = new JavaMarkObjectActionHandler(); @NotNull public BreakpointPanelProvider getBreakpointPanelProvider() { @@ -150,6 +151,12 @@ public class JavaDebuggerSupport extends DebuggerSupport { return myMuteBreakpointsHandler; } + @NotNull + @Override + public MarkObjectActionHandler getMarkObjectHandler() { + return myMarkObjectActionHandler; + } + @Override public AbstractDebuggerSession getCurrentSession(@NotNull Project project) { final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext(); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java index fbbcad3b909c..7dd324df7cfa 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java @@ -19,7 +19,6 @@ */ package com.intellij.debugger.ui.impl; -import com.intellij.debugger.actions.DebuggerActions; import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.impl.DebuggerStateManager; import com.intellij.debugger.ui.impl.watch.DebuggerTree; @@ -30,6 +29,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy; import com.intellij.ui.PopupHandler; +import com.intellij.xdebugger.impl.actions.XDebuggerActions; import javax.swing.*; import java.awt.*; @@ -68,7 +68,7 @@ public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark"); final CustomShortcutSet shortcutSet = shortcuts.length > 0? new CustomShortcutSet(shortcuts) : new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)); - overrideShortcut(myTree, DebuggerActions.MARK_OBJECT, shortcutSet); + overrideShortcut(myTree, XDebuggerActions.MARK_OBJECT, shortcutSet); } protected abstract DebuggerTree createTreeView(); diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index f2e736bea908..78e3728bee67 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -672,6 +672,7 @@ icon="/debugger/muteBreakpoints.png"/> + @@ -699,12 +700,14 @@ + + @@ -717,6 +720,7 @@ + @@ -727,6 +731,7 @@ + diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java index 9a2079acb9b4..f40c0b90db7f 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java @@ -24,6 +24,7 @@ import com.intellij.execution.ui.RunnerLayoutUi; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.xdebugger.breakpoints.XBreakpointHandler; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; +import com.intellij.xdebugger.frame.XValueMarkerProvider; import com.intellij.xdebugger.stepping.XSmartStepIntoHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -161,6 +162,15 @@ public abstract class XDebugProcess { return consoleBuilder.getConsole(); } + /** + * Override this method to enable 'Mark Object' action + * @return new instance of {@link XValueMarkerProvider}'s implementation or {@code null} if 'Mark Object' feature isn't supported + */ + @Nullable + public XValueMarkerProvider createValueMarkerProvider() { + return null; + } + /** * Override this method to provide additional tabs for 'Debug' tool window */ diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java b/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java index b7723c2874d6..2278aa06af48 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java @@ -116,7 +116,6 @@ public abstract class XDebuggerEvaluator { * Override this method to format selected text before it is shown in 'Evaluate' dialog */ @NotNull - @SuppressWarnings({"MethodMayBeStatic"}) public String formatTextForEvaluation(@NotNull String text) { return text; } diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueMarkerProvider.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueMarkerProvider.java new file mode 100644 index 000000000000..07aa065b02e5 --- /dev/null +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueMarkerProvider.java @@ -0,0 +1,68 @@ +/* + * Copyright 2000-2011 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.frame; + +import org.jetbrains.annotations.NotNull; + +/** + * Provides implementation of 'Mark Object' feature.

+ * + * If debugger values have unique ids just return these ids from {@link #getMarker(XValue)} method. + * Alternatively implement {@link #markValue(XValue)} to store a value in some registry and implement {@link #unmarkValue(XValue, Object)} + * to remote it from the registry. In such a case the {@link #getMarker(XValue)} method can return {@code null} if the {@code value} isn't marked. + * + * @author nik + */ +public abstract class XValueMarkerProvider { + private final Class myValueClass; + + protected XValueMarkerProvider(Class valueClass) { + myValueClass = valueClass; + } + + /** + * @return {@code true} if 'Mark Object' action should be enabled for {@code value} + */ + public abstract boolean canMark(@NotNull V value); + + /** + * This method is used to determine whether the {@code value} was marked or not. The returned object is compared using {@link Object#equals(Object)} + * method with markers returned by {@link #markValue(XValue)} methods.

+ * This method may return {@code null} if the {@code value} wasn't marked by {@link #markValue(XValue)} method. + * @return a marker for {@code value} + */ + public abstract M getMarker(@NotNull V value); + + /** + * This method is called when 'Mark Object' action is invoked. Return an unique marker for {@code value} and store it in some registry + * if necessary. + * @return a marker for {@code value} + */ + @NotNull + public M markValue(@NotNull V value) { + return getMarker(value); + } + + /** + * This method is called when 'Unmark Object' action is invoked. + */ + public void unmarkValue(@NotNull V value, @NotNull M marker) { + } + + public final Class getValueClass() { + return myValueClass; + } +} 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 5b3394d8fa4a..9dc881326df8 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java @@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project; import com.intellij.xdebugger.AbstractDebuggerSession; import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler; +import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler; import com.intellij.xdebugger.impl.settings.DebuggerSettingsPanelProvider; @@ -33,7 +34,7 @@ import org.jetbrains.annotations.Nullable; public abstract class DebuggerSupport { private static final ExtensionPointName EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.debuggerSupport"); - @NotNull + @NotNull public static DebuggerSupport[] getDebuggerSupports() { return Extensions.getExtensions(EXTENSION_POINT); } @@ -96,6 +97,10 @@ public abstract class DebuggerSupport { @NotNull public abstract DebuggerToggleActionHandler getMuteBreakpointsHandler(); + @NotNull + public abstract MarkObjectActionHandler getMarkObjectHandler(); + + @Nullable public abstract AbstractDebuggerSession getCurrentSession(@NotNull Project project); } 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 ea8d0cfa129f..22affa7ee12c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -29,6 +29,7 @@ import com.intellij.execution.ui.ConsoleView; import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.execution.ui.RunnerLayoutUi; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.application.Result; import com.intellij.openapi.diagnostic.Logger; @@ -46,8 +47,10 @@ import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; import com.intellij.xdebugger.frame.XExecutionStack; import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.frame.XSuspendContext; +import com.intellij.xdebugger.frame.XValueMarkerProvider; import com.intellij.xdebugger.impl.breakpoints.*; import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager; +import com.intellij.xdebugger.impl.frame.XValueMarkers; import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import com.intellij.xdebugger.impl.ui.XDebugSessionData; import com.intellij.xdebugger.impl.ui.XDebugSessionTab; @@ -78,6 +81,7 @@ public class XDebugSessionImpl implements XDebugSession { private XSourcePosition myCurrentPosition; private boolean myPaused; private MyDependentBreakpointListener myDependentBreakpointListener; + private XValueMarkers myValueMarkers; private String mySessionName; private XDebugSessionTab mySessionTab; private XDebugSessionData mySessionData; @@ -255,6 +259,17 @@ public class XDebugSessionImpl implements XDebugSession { ExecutionManager.getInstance(getProject()).getContentManager().showRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor); } + public XValueMarkers getValueMarkers() { + ApplicationManager.getApplication().assertIsDispatchThread(); + if (myValueMarkers == null) { + XValueMarkerProvider provider = myDebugProcess.createValueMarkerProvider(); + if (provider != null) { + myValueMarkers = XValueMarkers.createValueMarkers(provider); + } + } + return myValueMarkers; + } + private static > XBreakpointType getBreakpointTypeClass(final XBreakpointHandler handler) { return XDebuggerUtil.getInstance().findBreakpointType(handler.getBreakpointTypeClass()); } 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 f1a33999d901..4a5858d3c598 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java @@ -22,6 +22,7 @@ import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler; +import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler; import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler; import com.intellij.xdebugger.impl.actions.handlers.*; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; @@ -54,6 +55,7 @@ public class XDebuggerSupport extends DebuggerSupport { private final XAddToWatchesFromEditorActionHandler myAddToWatchesActionHandler; private final DebuggerToggleActionHandler myMuteBreakpointsHandler; private final DebuggerActionHandler mySmartStepIntoHandler; + private final XMarkObjectActionHandler myMarkObjectActionHandler; public XDebuggerSupport() { myBreakpointPanelProvider = new XBreakpointPanelProvider(); @@ -106,6 +108,7 @@ public class XDebuggerSupport extends DebuggerSupport { myEvaluateHandler = new XDebuggerEvaluateActionHandler(); myQuickEvaluateHandler = new XQuickEvaluateHandler(); mySettingsPanelProvider = new XDebuggerSettingsPanelProviderImpl(); + myMarkObjectActionHandler = new XMarkObjectActionHandler(); } @NotNull @@ -194,6 +197,12 @@ public class XDebuggerSupport extends DebuggerSupport { return myMuteBreakpointsHandler; } + @NotNull + @Override + public MarkObjectActionHandler getMarkObjectHandler() { + return myMarkObjectActionHandler; + } + @Override public AbstractDebuggerSession getCurrentSession(@NotNull Project project) { return XDebuggerManager.getInstance(project).getCurrentSession(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectAction.java new file mode 100644 index 000000000000..a4d08501bb3e --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectAction.java @@ -0,0 +1,64 @@ +/* + * Copyright 2000-2011 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.actions; + +import com.intellij.idea.ActionsBundle; +import com.intellij.openapi.actionSystem.ActionPlaces; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.openapi.project.Project; +import com.intellij.xdebugger.impl.DebuggerSupport; +import org.jetbrains.annotations.NotNull; + +/** + * @author nik + */ +public class MarkObjectAction extends XDebuggerActionBase { + @Override + public void update(AnActionEvent event) { + Project project = event.getData(PlatformDataKeys.PROJECT); + boolean enabled = false; + Presentation presentation = event.getPresentation(); + boolean hidden = true; + if (project != null) { + for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) { + MarkObjectActionHandler handler = support.getMarkObjectHandler(); + hidden &= handler.isHidden(project, event); + if (handler.isEnabled(project, event)) { + enabled = true; + String text; + if (handler.isMarked(project, event)) { + text = ActionsBundle.message("action.Debugger.MarkObject.unmark.text"); + } + else { + text = ActionsBundle.message("action.Debugger.MarkObject.text"); + } + presentation.setText(text); + break; + } + } + } + presentation.setVisible(!hidden && (!ActionPlaces.isPopupPlace(event.getPlace()) || enabled)); + presentation.setEnabled(enabled); + } + + @NotNull + @Override + protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) { + return debuggerSupport.getMarkObjectHandler(); + } +} diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectActionHandler.java new file mode 100644 index 000000000000..e5a965ab37dc --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MarkObjectActionHandler.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2011 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.actions; + +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +/** + * @author nik + */ +public abstract class MarkObjectActionHandler extends DebuggerActionHandler { + public abstract boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event); +} diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java index 4819bbe1574d..5e3de16c1ebd 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java @@ -62,4 +62,5 @@ public interface XDebuggerActions { @NonNls String TOGGLE_SORT_VALUES = "XDebugger.ToggleSortValues"; @NonNls String AUTO_TOOLTIP = "XDebugger.AutoTooltip"; + @NonNls String MARK_OBJECT = "Debugger.MarkObject"; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XMarkObjectActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XMarkObjectActionHandler.java new file mode 100644 index 000000000000..c3a9b9842661 --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XMarkObjectActionHandler.java @@ -0,0 +1,90 @@ +/* + * Copyright 2000-2011 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.actions.handlers; + +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import com.intellij.xdebugger.XDebugSession; +import com.intellij.xdebugger.XDebuggerManager; +import com.intellij.xdebugger.frame.XValue; +import com.intellij.xdebugger.impl.XDebugSessionImpl; +import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler; +import com.intellij.xdebugger.impl.frame.XValueMarkers; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; +import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase; +import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author nik + */ +public class XMarkObjectActionHandler extends MarkObjectActionHandler { + @Override + public void perform(@NotNull Project project, AnActionEvent event) { + XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); + if (session == null) return; + + XValueMarkers markers = ((XDebugSessionImpl)session).getValueMarkers(); + XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext()); + if (markers == null || node == null) return; + XValue value = node.getValueContainer(); + + ValueMarkup existing = markers.getMarkup(value); + if (existing != null) { + markers.unmarkValue(value); + } + else { + ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(node.getName()); + dialog.show(); + ValueMarkup markup = dialog.getConfiguredMarkup(); + if (dialog.isOK() && markup != null) { + markers.markValue(value, markup); + } + } + session.rebuildViews(); + } + + @Override + public boolean isEnabled(@NotNull Project project, AnActionEvent event) { + XValueMarkers markers = getValueMarkers(project); + if (markers == null) return false; + + XValue value = XDebuggerTreeActionBase.getSelectedValue(event.getDataContext()); + return value != null && markers.canMarkValue(value); + } + + @Override + public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) { + XValueMarkers markers = getValueMarkers(project); + if (markers == null) return false; + + XValue value = XDebuggerTreeActionBase.getSelectedValue(event.getDataContext()); + return value != null && markers.getMarkup(value) != null; + } + + @Override + public boolean isHidden(@NotNull Project project, AnActionEvent event) { + return getValueMarkers(project) == null; + } + + @Nullable + private static XValueMarkers getValueMarkers(@NotNull Project project) { + XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); + return session != null ? ((XDebugSessionImpl)session).getValueMarkers() : null; + } +} diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java new file mode 100644 index 000000000000..56d34dafd6fa --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2011 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.frame; + +import com.intellij.xdebugger.frame.XValue; +import com.intellij.xdebugger.frame.XValueMarkerProvider; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author nik + */ +public class XValueMarkers { + private final XValueMarkerProvider myProvider; + private final Map myMarkers; + + private XValueMarkers(@NotNull XValueMarkerProvider provider) { + myProvider = provider; + myMarkers = new HashMap(); + } + + public static XValueMarkers createValueMarkers(@NotNull XValueMarkerProvider provider) { + return new XValueMarkers(provider); + } + + @Nullable + public ValueMarkup getMarkup(@NotNull XValue value) { + Class valueClass = myProvider.getValueClass(); + if (!valueClass.isInstance(value)) return null; + + V v = valueClass.cast(value); + if (!myProvider.canMark(v)) return null; + + M m = myProvider.getMarker(v); + if (m == null) return null; + + return myMarkers.get(m); + } + + public boolean canMarkValue(@NotNull XValue value) { + Class valueClass = myProvider.getValueClass(); + if (!valueClass.isInstance(value)) return false; + + return myProvider.canMark(valueClass.cast(value)); + } + + public void markValue(@NotNull XValue value, @NotNull ValueMarkup markup) { + //noinspection unchecked + M m = myProvider.markValue((V)value); + myMarkers.put(m, markup); + } + + public void unmarkValue(@NotNull XValue value) { + //noinspection unchecked + M m = myProvider.getMarker((V)value); + if (m != null) { + myMarkers.remove(m); + } + } +} diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.java index 57164045b3d8..4e164cc7fd15 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.java @@ -15,83 +15,14 @@ */ package com.intellij.xdebugger.impl.ui.tree; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.ui.FixedSizeButton; -import com.intellij.ui.ColorChooser; -import com.intellij.ui.DocumentAdapter; -import com.intellij.ui.SimpleColoredComponent; -import com.intellij.ui.SimpleTextAttributes; import org.jetbrains.annotations.Nullable; -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - /** * @author nik */ -public abstract class ValueMarkerPresentationDialog extends DialogWrapper { - private static final Color DEFAULT_COLOR = Color.RED; - private SimpleColoredComponent myColorSample; - private Color myColor; - private JPanel myMainPanel; - private JTextField myLabelField; - private FixedSizeButton myChooseColorButton; - private JPanel mySamplePanel; - - public ValueMarkerPresentationDialog(final @Nullable String defaultText) { - super(true); - setTitle("Select Object Label"); - setModal(true); - myLabelField.getDocument().addDocumentListener(new DocumentAdapter() { - protected void textChanged(final DocumentEvent e) { - updateLabelSample(); - } - }); - myChooseColorButton.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - final Color color = ColorChooser.chooseColor(myColorSample, "Choose Label Color", myColor); - if (color != null) { - myColor = color; - updateLabelSample(); - } - } - }); - myColor = DEFAULT_COLOR; - if (defaultText != null) { - myLabelField.setText(defaultText.trim()); - updateLabelSample(); - } - } - - public JComponent getPreferredFocusedComponent() { - return myLabelField; - } - - @Override - protected JComponent createCenterPanel() { - return myMainPanel; - } - - private void updateLabelSample() { - myColorSample.clear(); - SimpleTextAttributes attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, myColor); - myColorSample.append(myLabelField.getText().trim(), attributes); - } - - @Nullable - public ValueMarkup getConfiguredMarkup() { - final String text = myLabelField.getText().trim(); - return text.isEmpty() ? null : new ValueMarkup(text, myColor, null); - } - - private void createUIComponents() { - myColorSample = new SimpleColoredComponent(); - mySamplePanel = new JPanel(new BorderLayout()); - mySamplePanel.setBorder(BorderFactory.createEtchedBorder()); - mySamplePanel.add(BorderLayout.CENTER, myColorSample); - myChooseColorButton = new FixedSizeButton(mySamplePanel); +public class ValueMarkerPresentationDialog extends ValueMarkerPresentationDialogBase { + public ValueMarkerPresentationDialog(@Nullable String defaultText) { + super(defaultText); + init(); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.form similarity index 99% rename from platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.form rename to platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.form index 1a09d3670a7a..ed01c69a295b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialog.form +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.form @@ -1,5 +1,5 @@ -

+ diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.java new file mode 100644 index 000000000000..3633c553e57e --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/ValueMarkerPresentationDialogBase.java @@ -0,0 +1,97 @@ +/* + * Copyright 2000-2011 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; + +import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.FixedSizeButton; +import com.intellij.ui.ColorChooser; +import com.intellij.ui.DocumentAdapter; +import com.intellij.ui.SimpleColoredComponent; +import com.intellij.ui.SimpleTextAttributes; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author nik + */ +public abstract class ValueMarkerPresentationDialogBase extends DialogWrapper { + private static final Color DEFAULT_COLOR = Color.RED; + private SimpleColoredComponent myColorSample; + private Color myColor; + private JPanel myMainPanel; + private JTextField myLabelField; + private FixedSizeButton myChooseColorButton; + private JPanel mySamplePanel; + + public ValueMarkerPresentationDialogBase(final @Nullable String defaultText) { + super(true); + setTitle("Select Object Label"); + setModal(true); + myLabelField.getDocument().addDocumentListener(new DocumentAdapter() { + protected void textChanged(final DocumentEvent e) { + updateLabelSample(); + } + }); + myChooseColorButton.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent e) { + final Color color = ColorChooser.chooseColor(myColorSample, "Choose Label Color", myColor); + if (color != null) { + myColor = color; + updateLabelSample(); + } + } + }); + myColor = DEFAULT_COLOR; + if (defaultText != null) { + myLabelField.setText(defaultText.trim()); + updateLabelSample(); + } + } + + public JComponent getPreferredFocusedComponent() { + return myLabelField; + } + + @Override + protected JComponent createCenterPanel() { + return myMainPanel; + } + + private void updateLabelSample() { + myColorSample.clear(); + SimpleTextAttributes attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, myColor); + myColorSample.append(myLabelField.getText().trim(), attributes); + } + + @Nullable + public ValueMarkup getConfiguredMarkup() { + final String text = myLabelField.getText().trim(); + return text.isEmpty() ? null : new ValueMarkup(text, myColor, null); + } + + private void createUIComponents() { + myColorSample = new SimpleColoredComponent(); + mySamplePanel = new JPanel(new BorderLayout()); + mySamplePanel.setBorder(BorderFactory.createEtchedBorder()); + mySamplePanel.add(BorderLayout.CENTER, myColorSample); + myChooseColorButton = new FixedSizeButton(mySamplePanel); + } +} 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 14db80c9e617..64483c7ab66e 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 @@ -18,6 +18,7 @@ package com.intellij.xdebugger.impl.ui.tree; import com.intellij.ide.dnd.aware.DnDAwareTree; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.keymap.KeymapManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener; import com.intellij.ui.PopupHandler; @@ -210,6 +211,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa actionManager.getAction(XDebuggerActions.SET_VALUE).unregisterCustomShortcutSet(this); actionManager.getAction(XDebuggerActions.COPY_VALUE).unregisterCustomShortcutSet(this); actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).unregisterCustomShortcutSet(this); + actionManager.getAction(XDebuggerActions.MARK_OBJECT).unregisterCustomShortcutSet(this); } private void registerShortcuts() { @@ -217,6 +219,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa actionManager.getAction(XDebuggerActions.SET_VALUE).registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this); actionManager.getAction(XDebuggerActions.COPY_VALUE).registerCustomShortcutSet(CommonShortcuts.getCopy(), this); actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).registerCustomShortcutSet(CommonShortcuts.getEditSource(), this); + actionManager.getAction(XDebuggerActions.MARK_OBJECT).registerCustomShortcutSet(new CustomShortcutSet( KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")), this); } private static void markNodesObsolete(final XValueContainerNode node) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java index d67dbe636b9a..25205fa1da98 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java @@ -24,6 +24,7 @@ import com.intellij.xdebugger.frame.XValue; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -34,7 +35,7 @@ import javax.swing.*; public class XInspectDialog extends DialogWrapper { private final XDebuggerTreePanel myTreePanel; - public XInspectDialog(final XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, String nodeName, XValue value) { + public XInspectDialog(final XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, @NotNull String nodeName, @NotNull XValue value) { super(session.getProject(), false); setTitle(XDebuggerBundle.message("inspect.value.dialog.title", nodeName)); setModal(false); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XDebuggerTreeActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XDebuggerTreeActionBase.java index 120916b82546..367061ff369e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XDebuggerTreeActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XDebuggerTreeActionBase.java @@ -53,7 +53,7 @@ public abstract class XDebuggerTreeActionBase extends AnAction { } @Nullable - protected static XValueNodeImpl getSelectedNode(final DataContext dataContext) { + public static XValueNodeImpl getSelectedNode(final DataContext dataContext) { XDebuggerTree tree = XDebuggerTree.getTree(dataContext); if (tree == null) return null; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XStackFrameNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XStackFrameNode.java index 590bce5318d8..fa32ebcc4d75 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XStackFrameNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XStackFrameNode.java @@ -17,12 +17,13 @@ package com.intellij.xdebugger.impl.ui.tree.nodes; import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; +import org.jetbrains.annotations.NotNull; /** * @author nik */ public class XStackFrameNode extends XValueContainerNode { - public XStackFrameNode(final XDebuggerTree tree, final XStackFrame xStackFrame) { + public XStackFrameNode(final @NotNull XDebuggerTree tree, final @NotNull XStackFrame xStackFrame) { super(tree, null, xStackFrame); setLeaf(false); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java index 237ef6b99e71..4053b2b877b1 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java @@ -39,7 +39,7 @@ public abstract class XValueContainerNode implements XValu private String mySeparator; private boolean myChanged; - public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final XValue value) { + public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final @NotNull XValue value) { super(tree, parent, value); myName = name; if (myName != null) { @@ -106,6 +109,13 @@ public class XValueNodeImpl extends XValueContainerNode implements XValu private void updateText() { myText.clear(); + XValueMarkers markers = ((XDebugSessionImpl)myTree.getSession()).getValueMarkers(); + if (markers != null) { + ValueMarkup markup = markers.getMarkup(myValueContainer); + if (markup != null) { + myText.append("[" + markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor())); + } + } myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES); myText.append(mySeparator, SimpleTextAttributes.REGULAR_ATTRIBUTES); if (myType != null) { diff --git a/resources/src/idea/IdeaActions.xml b/resources/src/idea/IdeaActions.xml index c7146a82f873..5d07dcd316b7 100644 --- a/resources/src/idea/IdeaActions.xml +++ b/resources/src/idea/IdeaActions.xml @@ -299,7 +299,6 @@ -