use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class ResumeThreadAction method update.
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
boolean visible = false;
boolean enabled = false;
String text = DebuggerBundle.message("action.resume.thread.text.resume");
if (selectedNodes != null && selectedNodes.length > 0) {
visible = true;
enabled = true;
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || !((ThreadDescriptorImpl) threadDescriptor).isSuspended()) {
visible = false;
break;
}
}
}
final Presentation presentation = e.getPresentation();
presentation.setText(text);
presentation.setVisible(visible);
presentation.setEnabled(enabled);
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class ResumeThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null)
return;
//noinspection ConstantConditions
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
final ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
if (threadDescriptor.isSuspended()) {
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
SuspendContextImpl suspendingContext = SuspendManagerUtil.getSuspendingContext(debugProcess.getSuspendManager(), thread);
if (suspendingContext != null) {
debugProcess.createResumeThreadCommand(suspendingContext, thread).run();
}
debuggerTreeNode.calcValue();
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class ShowAllAs method actionPerformed.
public void actionPerformed(AnActionEvent e) {
DebuggerTreeNodeImpl selectedNode = (DebuggerTreeNodeImpl) ((DebuggerUtilsEx) DebuggerUtils.getInstance()).getSelectedNode(e.getDataContext());
if (selectedNode == null)
return;
if (!isPrimitiveArray(selectedNode))
return;
final DebuggerContext debuggerContext = DebuggerUtils.getInstance().getDebuggerContext(e.getDataContext());
if (debuggerContext == null || debuggerContext.getDebugProcess() == null)
return;
for (Enumeration children = selectedNode.children(); children.hasMoreElements(); ) {
final DebuggerTreeNode child = (DebuggerTreeNode) children.nextElement();
if (child.getDescriptor() instanceof ValueDescriptor) {
debuggerContext.getDebugProcess().getManagerThread().invokeCommand(new SuspendContextCommand() {
public SuspendContext getSuspendContext() {
return debuggerContext.getSuspendContext();
}
public void action() {
child.setRenderer(myRenderer);
}
public void commandCancelled() {
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project android by JetBrains.
the class InstancesTreeView method getTargetFiles.
@Nullable
private PsiClassNavigation[] getTargetFiles() {
Object node = myDebuggerTree.getSelectionPath().getLastPathComponent();
String className = null;
if (node instanceof DebuggerTreeNodeImpl) {
NodeDescriptorImpl nodeDescriptor = ((DebuggerTreeNodeImpl) node).getDescriptor();
if (nodeDescriptor instanceof InstanceFieldDescriptorImpl) {
Instance instance = ((InstanceFieldDescriptorImpl) nodeDescriptor).getInstance();
if (instance != null) {
if (instance instanceof ClassObj) {
className = ((ClassObj) instance).getClassName();
} else {
className = instance.getClassObj().getClassName();
if (instance instanceof ArrayInstance) {
className = className.replace("[]", "");
}
}
}
}
}
return PsiClassNavigation.getNavigationForClass(myProject, className);
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project android by JetBrains.
the class InstancesTreeView method expandMoreNodesUntilFound.
@Nullable
private DebuggerTreeNodeImpl expandMoreNodesUntilFound(@NotNull DebuggerTreeNodeImpl node, @NotNull Instance targetInstance) {
if (node.getDescriptor() instanceof ContainerDescriptorImpl) {
int startIndex = 0;
if (node.getChildCount() > 0) {
DebuggerTreeNodeImpl lastNode = (DebuggerTreeNodeImpl) node.getChildAt(node.getChildCount() - 1);
if (lastNode.getDescriptor() instanceof ExpansionDescriptorImpl) {
lastNode.removeFromParent();
startIndex = node.getChildCount() - 1;
} else {
for (int scanIndex = 0; scanIndex < node.getChildCount(); ++scanIndex) {
DebuggerTreeNodeImpl scanNode = (DebuggerTreeNodeImpl) node.getChildAt(scanIndex);
NodeDescriptor nodeDescriptor = scanNode.getDescriptor();
if (nodeDescriptor instanceof InstanceFieldDescriptorImpl && ((InstanceFieldDescriptorImpl) nodeDescriptor).getInstance() == targetInstance) {
return scanNode;
}
}
return null;
}
}
int maxSize = ((ContainerDescriptorImpl) node.getDescriptor()).getInstances().size();
while (startIndex < maxSize) {
addContainerChildren(node, startIndex, false);
for (int scanIndex = startIndex; scanIndex < node.getChildCount(); ++scanIndex) {
DebuggerTreeNodeImpl scanNode = (DebuggerTreeNodeImpl) node.getChildAt(scanIndex);
NodeDescriptor nodeDescriptor = scanNode.getDescriptor();
if (nodeDescriptor instanceof InstanceFieldDescriptorImpl && ((InstanceFieldDescriptorImpl) nodeDescriptor).getInstance() == targetInstance) {
addExpansionNode(node, node.getChildCount(), maxSize);
return scanNode;
}
}
startIndex = node.getChildCount();
}
}
return null;
}
Aggregations