use of com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState in project intellij-community by JetBrains.
the class XMarkObjectActionHandler method perform.
@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();
boolean detachedView = DebuggerUIUtil.isInDetachedTree(event);
XDebuggerTreeState treeState = XDebuggerTreeState.saveState(node.getTree());
ValueMarkup existing = markers.getMarkup(value);
if (existing != null) {
markers.unmarkValue(value);
} else {
ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(event.getData(CONTEXT_COMPONENT), node.getName());
dialog.show();
ValueMarkup markup = dialog.getConfiguredMarkup();
if (dialog.isOK() && markup != null) {
markers.markValue(value, markup);
}
}
if (detachedView) {
node.getTree().rebuildAndRestore(treeState);
}
session.rebuildViews();
}
use of com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState in project intellij-community by JetBrains.
the class DebuggerUIUtil method setTreeNodeValue.
public static void setTreeNodeValue(XValueNodeImpl valueNode, String text, Consumer<String> errorConsumer) {
XDebuggerTree tree = valueNode.getTree();
Project project = tree.getProject();
XValueModifier modifier = valueNode.getValueContainer().getModifier();
if (modifier == null)
return;
XDebuggerTreeState treeState = XDebuggerTreeState.saveState(tree);
valueNode.setValueModificationStarted();
modifier.setValue(text, new XValueModifier.XModificationCallback() {
@Override
public void valueModified() {
if (tree.isDetached()) {
AppUIUtil.invokeOnEdt(() -> tree.rebuildAndRestore(treeState));
}
XDebuggerUtilImpl.rebuildAllSessionsViews(project);
}
@Override
public void errorOccurred(@NotNull final String errorMessage) {
AppUIUtil.invokeOnEdt(() -> {
tree.rebuildAndRestore(treeState);
errorConsumer.consume(errorMessage);
});
XDebuggerUtilImpl.rebuildAllSessionsViews(project);
}
});
}
Aggregations