mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-129621 Watches cannot be modified when not debugging
This commit is contained in:
+4
-2
@@ -39,7 +39,7 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor {
|
||||
@Nullable private final WatchNode myOldNode;
|
||||
|
||||
public WatchInplaceEditor(@NotNull WatchesRootNode rootNode,
|
||||
@NotNull XDebugSession session, XWatchesView watchesView, final WatchNode node,
|
||||
@Nullable XDebugSession session, XWatchesView watchesView, final WatchNode node,
|
||||
@NonNls final String historyId,
|
||||
final @Nullable WatchNode oldNode) {
|
||||
super((XDebuggerTreeNode)node, historyId);
|
||||
@@ -47,7 +47,9 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor {
|
||||
myWatchesView = watchesView;
|
||||
myOldNode = oldNode;
|
||||
myExpressionEditor.setExpression(oldNode != null ? oldNode.getExpression() : null);
|
||||
new WatchEditorSessionListener(session).install();
|
||||
if (session != null) {
|
||||
new WatchEditorSessionListener(session).install();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.execution.ui.layout.ViewContext;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.SingleAlarm;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
@@ -66,15 +67,20 @@ public abstract class XDebugView implements Disposable {
|
||||
|
||||
@Nullable
|
||||
public static XDebugSession getSession(@NotNull Component component) {
|
||||
return getData(XDebugSession.DATA_KEY, component);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T> T getData(DataKey<T> key, @NotNull Component component) {
|
||||
DataContext dataContext = DataManager.getInstance().getDataContext(component);
|
||||
ViewContext viewContext = ViewContext.CONTEXT_KEY.getData(dataContext);
|
||||
ContentManager contentManager = viewContext == null ? null : viewContext.getContentManager();
|
||||
if (contentManager != null) {
|
||||
XDebugSession session = XDebugSession.DATA_KEY.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
|
||||
if (session != null) {
|
||||
return session;
|
||||
T data = key.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return XDebugSession.DATA_KEY.getData(dataContext);
|
||||
return key.getData(dataContext);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-7
@@ -40,6 +40,7 @@ import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
|
||||
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel;
|
||||
@@ -220,13 +221,9 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
|
||||
@Override
|
||||
public void addWatchExpression(@NotNull XExpression expression, int index, final boolean navigateToWatchNode) {
|
||||
XDebugSession session = getSession(getTree());
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
myRootNode.addWatchExpression(session.getDebugProcess().getEvaluator(), expression, index, navigateToWatchNode);
|
||||
myRootNode.addWatchExpression(session != null ? session.getDebugProcess().getEvaluator() : null, expression, index, navigateToWatchNode);
|
||||
updateSessionData();
|
||||
if (navigateToWatchNode) {
|
||||
if (navigateToWatchNode && session != null) {
|
||||
showWatchesTab((XDebugSessionImpl)session);
|
||||
}
|
||||
}
|
||||
@@ -342,8 +339,15 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
|
||||
}
|
||||
|
||||
XDebugSession session = getSession(getTree());
|
||||
XExpression[] expressions = watchExpressions.toArray(new XExpression[watchExpressions.size()]);
|
||||
if (session != null) {
|
||||
((XDebugSessionImpl)session).setWatchExpressions(watchExpressions.toArray(new XExpression[watchExpressions.size()]));
|
||||
((XDebugSessionImpl)session).setWatchExpressions(expressions);
|
||||
}
|
||||
else {
|
||||
XDebugSessionData data = getData(XDebugSessionData.DATA_KEY, getTree());
|
||||
if (data != null) {
|
||||
data.setWatchExpressions(expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -188,9 +188,7 @@ public class WatchesRootNode extends XDebuggerTreeNode {
|
||||
fireNodeStructureChanged(messageNode);
|
||||
}
|
||||
XDebugSession session = XDebugView.getSession(myTree);
|
||||
if (session != null) {
|
||||
new WatchInplaceEditor(this, session, myWatchesView, messageNode, "watch", node).show();
|
||||
}
|
||||
new WatchInplaceEditor(this, session, myWatchesView, messageNode, "watch", node).show();
|
||||
}
|
||||
|
||||
private class MyEvaluationCallback extends XEvaluationCallbackBase {
|
||||
|
||||
Reference in New Issue
Block a user