diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties
index dbee7795ee2b..3fee1441bcb4 100644
--- a/platform/platform-resources-en/src/messages/ActionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties
@@ -891,7 +891,9 @@ action.XDebugger.CompareValueWithClipboard.description=Compare value of selected
action.XDebugger.CopyName.text=Copy Name
action.XDebugger.CopyName.description=Copy name of selected node to clipboard
action.XDebugger.JumpToSource.text=Jump To Source
-action.XDebugger.JumpToSource.description=Open for the selected item
+action.XDebugger.JumpToSource.description=Open source of the selected item
+action.XDebugger.JumpToTypeSource.text=Jump To Type Source
+action.XDebugger.JumpToTypeSource.description=Open source of the selected value's type
action.XDebugger.Inspect.text=Inspect...
action.XDebugger.AddToWatches.text=Add to Watches
action.XDebugger.RemoveWatch.text=Remove Watch
diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml
index e83d3f98342a..77c3b5f9f8f3 100644
--- a/platform/platform-resources/src/idea/LangActions.xml
+++ b/platform/platform-resources/src/idea/LangActions.xml
@@ -652,6 +652,7 @@
+
@@ -701,6 +702,7 @@
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.java
index 011daed6f0a3..a11eb41ebf66 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.java
@@ -59,4 +59,22 @@ public abstract class XValue extends XValueContainer {
public void computeSourcePosition(@NotNull XNavigatable navigatable) {
navigatable.setSourcePosition(null);
}
+
+ /**
+ * Return {@code true} from this method and override {@link #computeTypeSourcePosition(XNavigatable)} if navigation to the value's type
+ * is supported for the value
+ * @return {@code true} if navigation to the value's type is supported
+ */
+ public boolean canNavigateToTypeSource() {
+ return false;
+ }
+
+ /**
+ * Start computing source position of the value's type and call {@link XNavigatable#setSourcePosition(com.intellij.xdebugger.XSourcePosition)}
+ * when computation is finished.
+ * Note that this method is called from the Event Dispatch thread so it should return quickly.
+ */
+ public void computeTypeSourcePosition(@NotNull XNavigatable navigatable) {
+ navigatable.setSourcePosition(null);
+ }
}
\ No newline at end of file
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 db13c1b9944d..859638482aa6 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
@@ -33,9 +33,11 @@ public interface XDebuggerActions {
@NonNls String RUN_TO_CURSOR = "RunToCursor";
@NonNls String FORCE_RUN_TO_CURSOR = "ForceRunToCursor";
+ @NonNls String EDIT_TYPE_SOURCE = "Debugger.EditTypeSource";
@NonNls String SHOW_EXECUTION_POINT = "ShowExecutionPoint";
@NonNls String JUMP_TO_SOURCE = "XDebugger.JumpToSource";
+ @NonNls String JUMP_TO_TYPE_SOURCE = "XDebugger.JumpToTypeSource";
@NonNls String EVALUATE_EXPRESSION = "EvaluateExpression";
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 24e422fcfe5d..c38f925014d4 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
@@ -229,6 +229,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.JUMP_TO_TYPE_SOURCE).unregisterCustomShortcutSet(this);
actionManager.getAction(XDebuggerActions.MARK_OBJECT).unregisterCustomShortcutSet(this);
}
@@ -238,6 +239,8 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
.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);
+ Shortcut[] editTypeShortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(XDebuggerActions.EDIT_TYPE_SOURCE);
+ actionManager.getAction(XDebuggerActions.JUMP_TO_TYPE_SOURCE).registerCustomShortcutSet(new CustomShortcutSet(editTypeShortcuts), this);
actionManager.getAction(XDebuggerActions.MARK_OBJECT)
.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")), this);
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceAction.java
index 411b2004bb38..8367b535459d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceAction.java
@@ -15,36 +15,15 @@
*/
package com.intellij.xdebugger.impl.ui.tree.actions;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.intellij.ui.AppUIUtil;
-import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.frame.XNavigatable;
import com.intellij.xdebugger.frame.XValue;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author nik
*/
-public class XJumpToSourceAction extends XDebuggerTreeActionBase {
- protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) {
- XValue value = node.getValueContainer();
- value.computeSourcePosition(new XNavigatable() {
- public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) {
- if (sourcePosition != null) {
- AppUIUtil.invokeOnEdt(new Runnable() {
- public void run() {
- Project project = node.getTree().getProject();
- if (project.isDisposed()) return;
-
- sourcePosition.createNavigatable(project).navigate(true);
- }
- });
- }
- }
- });
+public class XJumpToSourceAction extends XJumpToSourceActionBase {
+ @Override
+ protected void startComputingSourcePosition(XValue value, XNavigatable navigatable) {
+ value.computeSourcePosition(navigatable);
}
-
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java
new file mode 100644
index 000000000000..e63447cb682b
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java
@@ -0,0 +1,52 @@
+/*
+ * 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.actions;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.Project;
+import com.intellij.ui.AppUIUtil;
+import com.intellij.xdebugger.XSourcePosition;
+import com.intellij.xdebugger.frame.XNavigatable;
+import com.intellij.xdebugger.frame.XValue;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author nik
+ */
+public abstract class XJumpToSourceActionBase extends XDebuggerTreeActionBase {
+ protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) {
+ XValue value = node.getValueContainer();
+ XNavigatable navigatable = new XNavigatable() {
+ public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) {
+ if (sourcePosition != null) {
+ AppUIUtil.invokeOnEdt(new Runnable() {
+ public void run() {
+ Project project = node.getTree().getProject();
+ if (project.isDisposed()) return;
+
+ sourcePosition.createNavigatable(project).navigate(true);
+ }
+ });
+ }
+ }
+ };
+ startComputingSourcePosition(value, navigatable);
+ }
+
+ protected abstract void startComputingSourcePosition(XValue value, XNavigatable navigatable);
+}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToTypeSourceAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToTypeSourceAction.java
new file mode 100644
index 000000000000..b5cb75e9b0b0
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToTypeSourceAction.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.actions;
+
+import com.intellij.xdebugger.frame.XNavigatable;
+import com.intellij.xdebugger.frame.XValue;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
+
+/**
+ * @author nik
+ */
+public class XJumpToTypeSourceAction extends XJumpToSourceActionBase {
+ @Override
+ protected void startComputingSourcePosition(XValue value, XNavigatable navigatable) {
+ value.computeTypeSourcePosition(navigatable);
+ }
+
+ @Override
+ protected boolean isEnabled(XValueNodeImpl node) {
+ return super.isEnabled(node) && node.getValueContainer().canNavigateToTypeSource();
+ }
+}