use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.
the class ForceEarlyReturnAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getProject();
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
if (stackFrame == null || project == null) {
return;
}
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
return;
}
final StackFrameProxyImpl proxy = stackFrame.getStackFrameProxy();
final ThreadReferenceProxyImpl thread = proxy.threadProxy();
debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext, thread) {
@Override
public void threadAction() {
Method method;
try {
method = proxy.location().method();
} catch (EvaluateException e) {
showError(project, DebuggerBundle.message("error.early.return", e.getLocalizedMessage()));
return;
}
if ("void".equals(method.returnTypeName())) {
forceEarlyReturnWithFinally(thread.getVirtualMachine().mirrorOfVoid(), stackFrame, debugProcess, null);
} else {
ApplicationManager.getApplication().invokeLater(() -> new ReturnExpressionDialog(project, debugProcess.getXdebugProcess().getEditorsProvider(), debugProcess, stackFrame).show());
}
}
});
}
use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.
the class DebuggerTreeNodeImpl method update.
private void update(final DebuggerContextImpl context, final Runnable runnable, boolean labelOnly) {
if (!labelOnly) {
clear();
}
if (context != null && context.getDebugProcess() != null) {
getTree().saveState(this);
myIcon = DebuggerTreeRenderer.getDescriptorIcon(MessageDescriptor.EVALUATING);
myText = DebuggerTreeRenderer.getDescriptorText(context, MessageDescriptor.EVALUATING, false);
context.getDebugProcess().getManagerThread().invoke(new DebuggerContextCommandImpl(context) {
@Override
public void threadAction() {
runnable.run();
}
@Override
protected void commandCancelled() {
clear();
getDescriptor().clear();
updateCaches();
labelChanged();
childrenChanged(true);
}
@Override
public Priority getPriority() {
return Priority.NORMAL;
}
});
}
labelChanged();
if (!labelOnly) {
childrenChanged(true);
}
}
use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.
the class EditSourceAction method update.
public void update(AnActionEvent e) {
final Project project = e.getProject();
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (debuggerContext.getDebugProcess() != null) {
presentation.setEnabled(true);
debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition position = getSourcePosition(node, debuggerContext);
if (position == null) {
DebuggerInvocationUtil.swingInvokeLater(project, () -> presentation.setEnabled(false));
}
}
});
} else {
presentation.setEnabled(false);
}
e.getPresentation().setText(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getTemplatePresentation().getText());
}
use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.
the class EditSourceAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null) {
return;
}
final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if (selectedNode != null) {
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
DebugProcessImpl process = debuggerContext.getDebugProcess();
if (process != null) {
process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition sourcePosition = getSourcePosition(selectedNode, debuggerContext);
if (sourcePosition != null) {
sourcePosition.navigate(true);
}
}
});
}
}
}
use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.
the class AutoRendererAction method actionPerformed.
public void actionPerformed(@NotNull final AnActionEvent e) {
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess != null) {
final List<JavaValue> selectedValues = ViewAsGroup.getSelectedValues(e);
if (!selectedValues.isEmpty()) {
debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
for (JavaValue selectedValue : selectedValues) {
selectedValue.getDescriptor().setRenderer(null);
}
DebuggerAction.refreshViews(e);
}
});
}
}
}
Aggregations