mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+22
-7
@@ -16,12 +16,10 @@
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.settings.DebuggerDataViewsConfigurable;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.settings.UserRenderersConfigurable;
|
||||
import com.intellij.debugger.ui.impl.FrameVariablesTree;
|
||||
import com.intellij.debugger.ui.impl.WatchDebuggerTree;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -33,6 +31,12 @@ import com.intellij.openapi.options.TabbedConfigurable;
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
@@ -44,9 +48,15 @@ import java.util.List;
|
||||
* Date: Sep 26, 2003
|
||||
* Time: 4:39:53 PM
|
||||
*/
|
||||
public class CustomizeContextViewAction extends DebuggerAction{
|
||||
public class CustomizeContextViewAction extends XDebuggerTreeActionBase {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
perform(null, "", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
|
||||
Disposable disposable = Disposer.newDisposable();
|
||||
@@ -92,8 +102,13 @@ public class CustomizeContextViewAction extends DebuggerAction{
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
DebuggerTree tree = getTree(e.getDataContext());
|
||||
e.getPresentation().setVisible(tree instanceof FrameVariablesTree || tree instanceof WatchDebuggerTree);
|
||||
e.getPresentation().setText(ActionsBundle.actionText(DebuggerActions.CUSTOMIZE_VIEWS));
|
||||
final XDebuggerManager debuggerManager = XDebuggerManager.getInstance(getEventProject(e));
|
||||
final XDebugSession currentSession = debuggerManager.getCurrentSession();
|
||||
if (currentSession != null) {
|
||||
final XDebugProcess process = currentSession.getDebugProcess();
|
||||
e.getPresentation().setVisible(process instanceof JavaDebugProcess);
|
||||
e.getPresentation().setEnabled(process instanceof JavaDebugProcess);
|
||||
e.getPresentation().setText(ActionsBundle.actionText(DebuggerActions.CUSTOMIZE_VIEWS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+135
-90
@@ -19,6 +19,7 @@ import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerInvocationUtil;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.ContextUtil;
|
||||
import com.intellij.debugger.engine.JavaValue;
|
||||
import com.intellij.debugger.engine.evaluation.*;
|
||||
import com.intellij.debugger.engine.evaluation.expression.*;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
@@ -30,21 +31,18 @@ import com.intellij.debugger.ui.DebuggerExpressionComboBox;
|
||||
import com.intellij.debugger.ui.EditorEvaluationCommand;
|
||||
import com.intellij.debugger.ui.impl.DebuggerTreeRenderer;
|
||||
import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.debugger.ui.tree.render.HexRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.NodeRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.ValueLabelRenderer;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorListenerAdapter;
|
||||
import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.util.IJSwingUtilities;
|
||||
import com.intellij.xdebugger.frame.XValueModifier;
|
||||
import com.sun.jdi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -52,20 +50,26 @@ import javax.swing.*;
|
||||
* Class SetValueAction
|
||||
* @author Jeka
|
||||
*/
|
||||
public class SetValueAction extends DebuggerAction {
|
||||
public void update(AnActionEvent e) {
|
||||
boolean enable = false;
|
||||
DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
|
||||
if (node != null) {
|
||||
NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
if(descriptor instanceof ValueDescriptorImpl){
|
||||
ValueDescriptorImpl valueDescriptor = ((ValueDescriptorImpl)descriptor);
|
||||
enable = valueDescriptor.canSetValue();
|
||||
}
|
||||
}
|
||||
e.getPresentation().setVisible(enable);
|
||||
public class JavaValueModifier extends XValueModifier {
|
||||
private final JavaValue myJavaValue;
|
||||
|
||||
public JavaValueModifier(JavaValue javaValue) {
|
||||
myJavaValue = javaValue;
|
||||
}
|
||||
|
||||
//public void update(AnActionEvent e) {
|
||||
// boolean enable = false;
|
||||
// DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
|
||||
// if (node != null) {
|
||||
// NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
// if(descriptor instanceof ValueDescriptorImpl){
|
||||
// ValueDescriptorImpl valueDescriptor = ((ValueDescriptorImpl)descriptor);
|
||||
// enable = valueDescriptor.canSetValue();
|
||||
// }
|
||||
// }
|
||||
// e.getPresentation().setVisible(enable);
|
||||
//}
|
||||
//
|
||||
private void update(final DebuggerContextImpl context) {
|
||||
DebuggerInvocationUtil.swingInvokeLater(context.getProject(), new Runnable() {
|
||||
public void run() {
|
||||
@@ -78,12 +82,9 @@ public class SetValueAction extends DebuggerAction {
|
||||
//node.setState(context);
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent event) {
|
||||
final DebuggerTreeNodeImpl node = getSelectedNode(event.getDataContext());
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
final NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
@Override
|
||||
public void setValue(@NotNull String expression, @NotNull XModificationCallback callback) {
|
||||
final NodeDescriptorImpl descriptor = myJavaValue.getDescriptor();
|
||||
if (!(descriptor instanceof ValueDescriptorImpl)) {
|
||||
return;
|
||||
}
|
||||
@@ -91,9 +92,10 @@ public class SetValueAction extends DebuggerAction {
|
||||
return;
|
||||
}
|
||||
|
||||
final DebuggerTree tree = getTree(event.getDataContext());
|
||||
final DebuggerContextImpl debuggerContext = getDebuggerContext(event.getDataContext());
|
||||
tree.saveState(node);
|
||||
//final DebuggerTree tree = getTree(event.getDataContext());
|
||||
//final DebuggerContextImpl debuggerContext = getDebuggerContext(event.getDataContext());
|
||||
final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(myJavaValue.getProject()).getContext();
|
||||
//tree.saveState(node);
|
||||
|
||||
if (descriptor instanceof FieldDescriptorImpl) {
|
||||
FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl)descriptor;
|
||||
@@ -101,17 +103,19 @@ public class SetValueAction extends DebuggerAction {
|
||||
if (!field.isStatic()) {
|
||||
final ObjectReference object = fieldDescriptor.getObject();
|
||||
if (object != null) {
|
||||
askAndSet(node, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
set(expression, callback, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
|
||||
throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
object.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
|
||||
update(debuggerContext);
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
|
||||
InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
|
||||
}
|
||||
});
|
||||
@@ -122,17 +126,19 @@ public class SetValueAction extends DebuggerAction {
|
||||
ReferenceType refType = field.declaringType();
|
||||
if (refType instanceof ClassType) {
|
||||
final ClassType classType = (ClassType)refType;
|
||||
askAndSet(node, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
set(expression, callback, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
|
||||
throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
classType.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
|
||||
update(debuggerContext);
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
|
||||
InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
|
||||
field.declaringType().classLoader());
|
||||
}
|
||||
@@ -144,19 +150,19 @@ public class SetValueAction extends DebuggerAction {
|
||||
LocalVariableDescriptorImpl localDescriptor = (LocalVariableDescriptorImpl)descriptor;
|
||||
final LocalVariableProxyImpl local = localDescriptor.getLocalVariable();
|
||||
if (local != null) {
|
||||
askAndSet(node, debuggerContext, new SetValueRunnable() {
|
||||
set(expression, callback, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
debuggerContext.getFrameProxy().setValue(local, preprocessValue(evaluationContext, newValue, local.getType()));
|
||||
update(debuggerContext);
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
|
||||
evaluationContext.getClassLoader());
|
||||
}
|
||||
@@ -169,22 +175,23 @@ public class SetValueAction extends DebuggerAction {
|
||||
if (array != null) {
|
||||
if (VirtualMachineProxyImpl.isCollected(array)) {
|
||||
// will only be the case if debugger does not use ObjectReference.disableCollection() because of Patches.IBM_JDK_DISABLE_COLLECTION_BUG
|
||||
Messages.showWarningDialog(tree, DebuggerBundle.message("evaluation.error.array.collected") + "\n"+ DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
|
||||
node.getParent().calcValue();
|
||||
Messages.showWarningDialog(myJavaValue.getProject(), DebuggerBundle.message("evaluation.error.array.collected") + "\n"+ DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
|
||||
//node.getParent().calcValue();
|
||||
return;
|
||||
}
|
||||
final ArrayType arrType = (ArrayType)array.referenceType();
|
||||
askAndSet(node, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
set(expression, callback, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
|
||||
throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
array.setValue(elementDescriptor.getIndex(), preprocessValue(evaluationContext, newValue, arrType.componentType()));
|
||||
update(debuggerContext);
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, arrType.classLoader());
|
||||
}
|
||||
});
|
||||
@@ -193,18 +200,19 @@ public class SetValueAction extends DebuggerAction {
|
||||
else if (descriptor instanceof EvaluationDescriptor) {
|
||||
final EvaluationDescriptor evaluationDescriptor = (EvaluationDescriptor)descriptor;
|
||||
if (evaluationDescriptor.canSetValue()) {
|
||||
askAndSet(node, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
set(expression, callback, debuggerContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
|
||||
throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
|
||||
final Modifier modifier = evaluationDescriptor.getModifier();
|
||||
modifier.setValue(preprocessValue(evaluationContext, newValue, modifier.getExpectedType()));
|
||||
update(debuggerContext);
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException,
|
||||
EvaluateException {
|
||||
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
|
||||
evaluationContext.getClassLoader());
|
||||
}
|
||||
@@ -300,8 +308,9 @@ public class SetValueAction extends DebuggerAction {
|
||||
}
|
||||
}
|
||||
|
||||
private void askAndSet(final DebuggerTreeNodeImpl node, final DebuggerContextImpl debuggerContext, final SetValueRunnable setValueRunnable) {
|
||||
ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, debuggerContext.getProject());
|
||||
private void set(@NotNull final String expression, final XModificationCallback callback, final DebuggerContextImpl debuggerContext, final SetValueRunnable setValueRunnable) {
|
||||
final ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, debuggerContext.getProject());
|
||||
final EvaluationContextImpl evaluationContext = myJavaValue.getEvaluationContext();
|
||||
|
||||
SuspendContextCommandImpl askSetAction = new DebuggerContextCommandImpl(debuggerContext) {
|
||||
public Priority getPriority() {
|
||||
@@ -309,27 +318,62 @@ public class SetValueAction extends DebuggerAction {
|
||||
}
|
||||
|
||||
public void threadAction() {
|
||||
final NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
String initialString = "";
|
||||
if (descriptor instanceof ValueDescriptorImpl) {
|
||||
Value currentValue = ((ValueDescriptorImpl) descriptor).getValue();
|
||||
if (currentValue instanceof StringReference) {
|
||||
initialString = DebuggerUtilsEx.getValueOrErrorAsString(debuggerContext.createEvaluationContext(), currentValue);
|
||||
initialString = initialString == null ? "" : "\"" + DebuggerUtilsEx.translateStringValue(initialString) + "\"";
|
||||
}
|
||||
else if (currentValue instanceof PrimitiveValue) {
|
||||
ValueLabelRenderer renderer = ((ValueDescriptorImpl) descriptor).getRenderer(debuggerContext.getDebugProcess());
|
||||
initialString = getDisplayableString((PrimitiveValue) currentValue, renderer instanceof NodeRenderer && HexRenderer.UNIQUE_ID.equals(renderer.getUniqueId()));
|
||||
}
|
||||
ExpressionEvaluator evaluator = null;
|
||||
try {
|
||||
evaluator = DebuggerInvocationUtil
|
||||
.commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
|
||||
public ExpressionEvaluator compute() throws EvaluateException {
|
||||
return EvaluatorBuilderImpl
|
||||
.build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression), ContextUtil.getContextElement(evaluationContext),
|
||||
ContextUtil.getSourcePosition(evaluationContext));
|
||||
}
|
||||
});
|
||||
|
||||
final String initialString1 = initialString;
|
||||
final Project project = debuggerContext.getProject();
|
||||
DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
|
||||
public void run() {
|
||||
showEditor(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, initialString1), node, debuggerContext, setValueRunnable);
|
||||
|
||||
setValue(expression, evaluator, evaluationContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
|
||||
InvalidTypeException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException {
|
||||
if (!progressWindow.isCanceled()) {
|
||||
setValueRunnable.setValue(evaluationContext, newValue);
|
||||
//node.calcValue();
|
||||
}
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
|
||||
InvocationException,
|
||||
ClassNotLoadedException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException {
|
||||
return setValueRunnable.loadClass(evaluationContext, className);
|
||||
}
|
||||
});
|
||||
callback.valueModified();
|
||||
} catch (EvaluateException e) {
|
||||
callback.errorOccurred(e.getMessage());
|
||||
}
|
||||
//String initialString = "";
|
||||
//if (descriptor instanceof ValueDescriptorImpl) {
|
||||
// Value currentValue = ((ValueDescriptorImpl) descriptor).getValue();
|
||||
// if (currentValue instanceof StringReference) {
|
||||
// initialString = DebuggerUtilsEx.getValueOrErrorAsString(debuggerContext.createEvaluationContext(), currentValue);
|
||||
// initialString = initialString == null ? "" : "\"" + DebuggerUtilsEx.translateStringValue(initialString) + "\"";
|
||||
// }
|
||||
// else if (currentValue instanceof PrimitiveValue) {
|
||||
// ValueLabelRenderer renderer = ((ValueDescriptorImpl) descriptor).getRenderer(debuggerContext.getDebugProcess());
|
||||
// initialString = getDisplayableString((PrimitiveValue) currentValue, renderer instanceof NodeRenderer && HexRenderer.UNIQUE_ID.equals(renderer.getUniqueId()));
|
||||
// }
|
||||
//
|
||||
// final String initialString1 = initialString;
|
||||
// final Project project = debuggerContext.getProject();
|
||||
// DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
|
||||
// public void run() {
|
||||
// showEditor(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, initialString1), node, debuggerContext, setValueRunnable);
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -418,22 +462,23 @@ public class SetValueAction extends DebuggerAction {
|
||||
}
|
||||
});
|
||||
|
||||
SetValueAction.setValue(text.getText(), evaluator, evaluationContext, new SetValueRunnable() {
|
||||
setValue(text.getText(), evaluator, evaluationContext, new SetValueRunnable() {
|
||||
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
|
||||
InvalidTypeException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException {
|
||||
if(!progressWindow.isCanceled()) {
|
||||
InvalidTypeException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException {
|
||||
if (!progressWindow.isCanceled()) {
|
||||
setValueRunnable.setValue(evaluationContext, newValue);
|
||||
node.calcValue();
|
||||
}
|
||||
}
|
||||
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
|
||||
ClassNotLoadedException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException {
|
||||
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
|
||||
InvocationException,
|
||||
ClassNotLoadedException,
|
||||
EvaluateException,
|
||||
IncompatibleThreadStateException,
|
||||
InvalidTypeException {
|
||||
return setValueRunnable.loadClass(evaluationContext, className);
|
||||
}
|
||||
});
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.sun.jdi.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -133,7 +134,7 @@ public class JumpToObjectAction extends DebuggerAction{
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class NavigateCommand extends SourcePositionCommand {
|
||||
public static class NavigateCommand extends SourcePositionCommand {
|
||||
public NavigateCommand(final DebuggerContextImpl debuggerContext, final ValueDescriptor descriptor, final DebugProcessImpl debugProcess, final AnActionEvent e) {
|
||||
super(debuggerContext, descriptor, debugProcess, e);
|
||||
}
|
||||
@@ -195,7 +196,7 @@ public class JumpToObjectAction extends DebuggerAction{
|
||||
|
||||
protected abstract SourcePositionCommand createRetryCommand();
|
||||
|
||||
protected abstract void doAction(SourcePosition sourcePosition);
|
||||
protected abstract void doAction(@Nullable SourcePosition sourcePosition);
|
||||
|
||||
private ReferenceType loadClass(final String className) {
|
||||
final EvaluationContextImpl eContext = myDebuggerContext.createEvaluationContext();
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.JavaStackFrame;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
@@ -30,9 +31,11 @@ import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.sun.jdi.InvalidStackFrameException;
|
||||
import com.sun.jdi.NativeMethodException;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
@@ -78,6 +81,19 @@ public class PopFrameAction extends DebuggerAction {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
|
||||
if (session != null) {
|
||||
XStackFrame frame = session.getCurrentStackFrame();
|
||||
if (frame instanceof JavaStackFrame) {
|
||||
StackFrameProxyImpl proxy = ((JavaStackFrame)frame).getStackFrameProxy();
|
||||
return !proxy.isBottom() ? proxy : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
|
||||
StackFrameProxyImpl frameProxy = debuggerContext.getFrameProxy();
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class ShowLibraryFramesAction extends ToggleAction {
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
|
||||
public ShowLibraryFramesAction() {
|
||||
super("", "", AllIcons.Debugger.Class_filter);
|
||||
myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myShouldShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myShouldShow = !enabled;
|
||||
DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
|
||||
XDebuggerUtilImpl.rebuildAllSessionsViews(e.getProject());
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
|
||||
import com.intellij.debugger.ui.DebuggerPanelsManager;
|
||||
import com.intellij.debugger.ui.DebuggerSessionTab;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -40,6 +39,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.unscramble.ThreadDumpParser;
|
||||
import com.intellij.unscramble.ThreadState;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.sun.jdi.*;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
|
||||
@@ -68,9 +68,9 @@ public class ThreadDumpAction extends AnAction implements AnAction.TransparentUp
|
||||
final List<ThreadState> threads = buildThreadStates(vm);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final DebuggerSessionTab sessionTab = DebuggerPanelsManager.getInstance(project).getSessionTab();
|
||||
if (sessionTab != null) {
|
||||
sessionTab.addThreadDump(threads);
|
||||
XDebugSession xSession = session.getProcess().getXDebugSession();
|
||||
if (xSession != null) {
|
||||
DebuggerSessionTab.addThreadDump(project, threads, xSession.getUI(), session);
|
||||
}
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
|
||||
@@ -16,16 +16,21 @@
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.JavaValue;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.debugger.ui.tree.render.NodeRenderer;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.xdebugger.frame.XValue;
|
||||
import com.intellij.xdebugger.frame.XValuePlace;
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -55,15 +60,14 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
}
|
||||
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl[] nodes = DebuggerAction.getSelectedNodes(e.getDataContext());
|
||||
if (nodes == null) {
|
||||
XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
|
||||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
for (DebuggerTreeNodeImpl node : nodes) {
|
||||
if (node.getDescriptor() instanceof ValueDescriptorImpl) {
|
||||
if (((ValueDescriptorImpl)node.getDescriptor()).getLastRenderer() != myNodeRenderer) {
|
||||
return false;
|
||||
}
|
||||
XValue container = node.getValueContainer();
|
||||
if (container instanceof JavaValue) {
|
||||
if (((ValueDescriptorImpl)((JavaValue)container).getDescriptor()).getLastRenderer() != myNodeRenderer) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -71,23 +75,24 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
|
||||
public void setSelected(final AnActionEvent e, final boolean state) {
|
||||
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
|
||||
final DebuggerTreeNodeImpl[] nodes = DebuggerAction.getSelectedNodes(e.getDataContext());
|
||||
final XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
|
||||
|
||||
LOG.assertTrue(debuggerContext != null && nodes != null);
|
||||
LOG.assertTrue(debuggerContext != null && node != null);
|
||||
|
||||
debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
|
||||
public void threadAction() {
|
||||
for (final DebuggerTreeNodeImpl node : nodes) {
|
||||
if (node.getDescriptor() instanceof ValueDescriptorImpl) {
|
||||
final ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)node.getDescriptor();
|
||||
if (state) {
|
||||
valueDescriptor.setRenderer(myNodeRenderer);
|
||||
node.calcRepresentation();
|
||||
}
|
||||
XValue container = node.getValueContainer();
|
||||
if (container instanceof JavaValue) {
|
||||
final ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)((JavaValue)container).getDescriptor();
|
||||
if (state) {
|
||||
valueDescriptor.setRenderer(myNodeRenderer);
|
||||
valueDescriptor.updateRepresentation(debuggerContext.createEvaluationContext(), DescriptorLabelListener.DUMMY_LISTENER);
|
||||
container.computePresentation(node, XValuePlace.TREE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +101,7 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
private static AnAction [] calcChildren(DebuggerTreeNodeImpl[] nodes) {
|
||||
private static AnAction [] calcChildren(NodeDescriptorImpl[] descriptors) {
|
||||
List<AnAction> renderers = new ArrayList<AnAction>();
|
||||
|
||||
List<NodeRenderer> allRenderers = NodeRendererSettings.getInstance().getAllRenderers();
|
||||
@@ -106,8 +111,7 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
for (NodeRenderer nodeRenderer : allRenderers) {
|
||||
boolean allApp = true;
|
||||
|
||||
for (DebuggerTreeNodeImpl node : nodes) {
|
||||
NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
for (NodeDescriptorImpl descriptor : descriptors) {
|
||||
if (descriptor instanceof ValueDescriptorImpl) {
|
||||
anyValueDescriptor = true;
|
||||
ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)descriptor;
|
||||
@@ -155,7 +159,15 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
}
|
||||
|
||||
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(event.getDataContext());
|
||||
final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(event.getDataContext());
|
||||
XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
final XValue container = node.getValueContainer();
|
||||
if (!(container instanceof JavaValue)) {
|
||||
event.getPresentation().setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final DebugProcessImpl process = debuggerContext.getDebugProcess();
|
||||
if (process == null) {
|
||||
@@ -165,7 +177,7 @@ public class ViewAsGroup extends ActionGroup implements DumbAware {
|
||||
|
||||
process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
|
||||
public void threadAction() {
|
||||
myChildren = calcChildren(selectedNodes);
|
||||
myChildren = calcChildren(new NodeDescriptorImpl[]{((JavaValue)container).getDescriptor()});
|
||||
DebuggerAction.enableAction(event, myChildren.length > 0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,14 +15,11 @@
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.xdebugger.impl.ui.TextViewer;
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.XFetchValueActionBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -31,17 +28,25 @@ import java.awt.*;
|
||||
/*
|
||||
* @author Jeka
|
||||
*/
|
||||
public class ViewTextAction extends BaseValueAction {
|
||||
public class ViewTextAction extends XFetchValueActionBase {
|
||||
@Override
|
||||
protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
|
||||
final NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
final String labelText = descriptor instanceof ValueDescriptorImpl? ((ValueDescriptorImpl)descriptor).getValueLabel() : null;
|
||||
protected void handle(Project project, String value) {
|
||||
final MyDialog dialog = new MyDialog(project);
|
||||
dialog.setTitle(labelText != null? "View Text for: " + labelText : "View Text");
|
||||
dialog.setText(text);
|
||||
dialog.setTitle("View Text");
|
||||
dialog.setText(value);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
//@Override
|
||||
//protected void processText(final Project project, final String text, DebuggerTreeNodeImpl node, DebuggerContextImpl debuggerContext) {
|
||||
// final NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
// final String labelText = descriptor instanceof ValueDescriptorImpl? ((ValueDescriptorImpl)descriptor).getValueLabel() : null;
|
||||
// final MyDialog dialog = new MyDialog(project);
|
||||
// dialog.setTitle(labelText != null? "View Text for: " + labelText : "View Text");
|
||||
// dialog.setText(text);
|
||||
// dialog.show();
|
||||
//}
|
||||
|
||||
private static class MyDialog extends DialogWrapper {
|
||||
private final EditorTextField myTextViewer;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ContextUtil {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.PositionUtil");
|
||||
|
||||
@Nullable
|
||||
public static SourcePosition getSourcePosition(final StackFrameContext context) {
|
||||
public static SourcePosition getSourcePosition(@Nullable final StackFrameContext context) {
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.*;
|
||||
import com.sun.jdi.request.EventRequest;
|
||||
@@ -171,6 +173,10 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
final DebuggerSession session = mySession;
|
||||
if (session != null && session.isAttached()) {
|
||||
session.refresh(true);
|
||||
XDebugSession xDebugSession = getXDebugSession();
|
||||
if (xDebugSession != null) {
|
||||
xDebugSession.rebuildViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1531,7 +1537,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
|
||||
public ResumeCommand(SuspendContextImpl suspendContext) {
|
||||
super(suspendContext);
|
||||
final ThreadReferenceProxyImpl contextThread = mySession.getContextManager().getContext().getThreadProxy();
|
||||
final ThreadReferenceProxyImpl contextThread = getDebuggerContext().getThreadProxy();
|
||||
myContextThread = contextThread != null ? contextThread : (suspendContext != null? suspendContext.getThread() : null);
|
||||
}
|
||||
|
||||
@@ -1969,9 +1975,23 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
}
|
||||
}
|
||||
|
||||
public DebuggerContextImpl getDebuggerContext() {
|
||||
return mySession.getContextManager().getContext();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public XDebugSession getXDebugSession() {
|
||||
return XDebuggerManager.getInstance(myProject).getDebugSession(getExecutionResult().getExecutionConsole());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JavaDebugProcess getXdebugProcess() {
|
||||
XDebugSession session = getXDebugSession();
|
||||
return session != null ? (JavaDebugProcess)session.getDebugProcess() : null;
|
||||
}
|
||||
|
||||
public boolean areBreakpointsMuted() {
|
||||
return myBreakpointsMuted.get();
|
||||
XDebugSession session = getXDebugSession();
|
||||
return session != null && session.areBreakpointsMuted();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.ui.breakpoints.*;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaBreakpointHandler extends XBreakpointHandler {
|
||||
protected final DebugProcessImpl myProcess;
|
||||
|
||||
public JavaBreakpointHandler(@NotNull Class<? extends XBreakpointType<?, ?>> breakpointTypeClass, DebugProcessImpl process) {
|
||||
super(breakpointTypeClass);
|
||||
myProcess = process;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Breakpoint createJavaBreakpoint(@NotNull XBreakpoint xBreakpoint) {
|
||||
return BreakpointManager.getJavaBreakpoint(xBreakpoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBreakpoint(@NotNull XBreakpoint breakpoint) {
|
||||
final Breakpoint javaBreakpoint = createJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
BreakpointManager.addBreakpointInt(javaBreakpoint);
|
||||
myProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
javaBreakpoint.createRequest(myProcess);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBreakpoint(@NotNull final XBreakpoint breakpoint, boolean temporary) {
|
||||
final Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
myProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
javaBreakpoint.delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class JavaLineBreakpointHandler extends JavaBreakpointHandler {
|
||||
public JavaLineBreakpointHandler(DebugProcessImpl process) {
|
||||
super(JavaLineBreakpointType.class, process);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JavaExceptionBreakpointHandler extends JavaBreakpointHandler {
|
||||
public JavaExceptionBreakpointHandler(DebugProcessImpl process) {
|
||||
super(JavaExceptionBreakpointType.class, process);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JavaMethodBreakpointHandler extends JavaBreakpointHandler {
|
||||
public JavaMethodBreakpointHandler(DebugProcessImpl process) {
|
||||
super(JavaMethodBreakpointType.class, process);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JavaWildcardBreakpointHandler extends JavaBreakpointHandler {
|
||||
public JavaWildcardBreakpointHandler(DebugProcessImpl process) {
|
||||
super(JavaWildcardMethodBreakpointType.class, process);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JavaFieldBreakpointHandler extends JavaBreakpointHandler {
|
||||
public JavaFieldBreakpointHandler(DebugProcessImpl process) {
|
||||
super(JavaFieldBreakpointType.class, process);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public interface JavaBreakpointHandlerFactory {
|
||||
ExtensionPointName<JavaBreakpointHandlerFactory> EP_NAME = ExtensionPointName.create("com.intellij.debugger.javaBreakpointHandlerFactory");
|
||||
|
||||
JavaBreakpointHandler createHandler(DebugProcessImpl process);
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.actions.DebuggerActions;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextUtil;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.debugger.impl.DebuggerStateManager;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.ui.DebuggerContentInfo;
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.impl.ThreadsPanel;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.MessageDescriptor;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
|
||||
import com.intellij.debugger.ui.tree.NodeDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.execution.ui.RunnerLayoutUi;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManagerAdapter;
|
||||
import com.intellij.ui.content.ContentManagerEvent;
|
||||
import com.intellij.xdebugger.*;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.frame.XValueMarkerProvider;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
|
||||
import com.intellij.xdebugger.ui.XDebugTabLayouter;
|
||||
import com.sun.jdi.event.Event;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.JavaDebuggerEditorsProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaDebugProcess extends XDebugProcess {
|
||||
private final DebuggerSession myJavaSession;
|
||||
private final JavaDebuggerEditorsProvider myEditorsProvider;
|
||||
private final XBreakpointHandler<?>[] myBreakpointHandlers;
|
||||
private final NodeManagerImpl myNodeManager;
|
||||
|
||||
public JavaDebugProcess(@NotNull final XDebugSession session, final DebuggerSession javaSession) {
|
||||
super(session);
|
||||
myJavaSession = javaSession;
|
||||
myEditorsProvider = new JavaDebuggerEditorsProvider();
|
||||
DebugProcessImpl process = javaSession.getProcess();
|
||||
|
||||
List<XBreakpointHandler> handlers = new ArrayList<XBreakpointHandler>();
|
||||
handlers.add(new JavaBreakpointHandler.JavaLineBreakpointHandler(process));
|
||||
handlers.add(new JavaBreakpointHandler.JavaExceptionBreakpointHandler(process));
|
||||
handlers.add(new JavaBreakpointHandler.JavaFieldBreakpointHandler(process));
|
||||
handlers.add(new JavaBreakpointHandler.JavaMethodBreakpointHandler(process));
|
||||
handlers.add(new JavaBreakpointHandler.JavaWildcardBreakpointHandler(process));
|
||||
|
||||
for (JavaBreakpointHandlerFactory factory : Extensions.getExtensions(JavaBreakpointHandlerFactory.EP_NAME)) {
|
||||
handlers.add(factory.createHandler(process));
|
||||
}
|
||||
|
||||
myBreakpointHandlers = handlers.toArray(new XBreakpointHandler[handlers.size()]);
|
||||
|
||||
process.addDebugProcessListener(new DebugProcessAdapter() {
|
||||
@Override
|
||||
public void paused(final SuspendContext suspendContext) {
|
||||
SuspendContextImpl context = (SuspendContextImpl)suspendContext;
|
||||
context.initExecutionStacks();
|
||||
|
||||
List<Pair<Breakpoint, Event>> descriptors = DebuggerUtilsEx.getEventDescriptors(context);
|
||||
if (!descriptors.isEmpty()) {
|
||||
Breakpoint breakpoint = descriptors.get(0).getFirst();
|
||||
XBreakpoint xBreakpoint = breakpoint.getXBreakpoint();
|
||||
if (xBreakpoint != null) {
|
||||
getSession().breakpointReached(xBreakpoint, null, context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
getSession().positionReached(context);
|
||||
}
|
||||
});
|
||||
|
||||
myNodeManager = new NodeManagerImpl(session.getProject(), null) {
|
||||
@Override
|
||||
public DebuggerTreeNodeImpl createNode(final NodeDescriptor descriptor, EvaluationContext evaluationContext) {
|
||||
((NodeDescriptorImpl)descriptor).setContext((EvaluationContextImpl)evaluationContext);
|
||||
final DebuggerTreeNodeImpl node = new DebuggerTreeNodeImpl(null, descriptor);
|
||||
((NodeDescriptorImpl)descriptor).updateRepresentation((EvaluationContextImpl)evaluationContext, DescriptorLabelListener.DUMMY_LISTENER);
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebuggerTreeNodeImpl createMessageNode(MessageDescriptor descriptor) {
|
||||
return new DebuggerTreeNodeImpl(null, descriptor);
|
||||
}
|
||||
};
|
||||
session.addSessionListener(new XDebugSessionAdapter() {
|
||||
@Override
|
||||
public void beforeSessionResume() {
|
||||
myJavaSession.getProcess().getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
myNodeManager.setHistoryByContext(getDebuggerStateManager().getContext());
|
||||
}
|
||||
@Override
|
||||
public Priority getPriority() {
|
||||
return Priority.NORMAL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stackFrameChanged() {
|
||||
XStackFrame frame = session.getCurrentStackFrame();
|
||||
if (frame instanceof JavaStackFrame) {
|
||||
DebuggerContextUtil.setStackFrame(javaSession.getContextManager(), ((JavaStackFrame)frame).getStackFrameProxy());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private DebuggerStateManager getDebuggerStateManager() {
|
||||
return myJavaSession.getContextManager();
|
||||
}
|
||||
|
||||
public DebuggerSession getDebuggerSession() {
|
||||
return myJavaSession;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XDebuggerEditorsProvider getEditorsProvider() {
|
||||
return myEditorsProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startStepOver() {
|
||||
myJavaSession.stepOver(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startStepInto() {
|
||||
myJavaSession.stepInto(false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startForceStepInto() {
|
||||
myJavaSession.stepInto(true, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startStepOut() {
|
||||
myJavaSession.stepOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
myJavaSession.getProcess().dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startPausing() {
|
||||
myJavaSession.pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
myJavaSession.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runToPosition(@NotNull XSourcePosition position) {
|
||||
Document document = FileDocumentManager.getInstance().getDocument(position.getFile());
|
||||
myJavaSession.runToCursor(document, position.getLine(), false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XBreakpointHandler<?>[] getBreakpointHandlers() {
|
||||
return myBreakpointHandlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCanInitBreakpoints() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected ProcessHandler doGetProcessHandler() {
|
||||
return myJavaSession.getProcess().getExecutionResult().getProcessHandler();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ExecutionConsole createConsole() {
|
||||
return myJavaSession.getProcess().getExecutionResult().getExecutionConsole();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XDebugTabLayouter createTabLayouter() {
|
||||
return new XDebugTabLayouter() {
|
||||
@Override
|
||||
public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) {
|
||||
final ThreadsPanel panel = new ThreadsPanel(myJavaSession.getProject(), getDebuggerStateManager());
|
||||
final Content threadsContent = ui.createContent(
|
||||
DebuggerContentInfo.THREADS_CONTENT, panel, XDebuggerBundle.message("debugger.session.tab.threads.title"),
|
||||
AllIcons.Debugger.Threads, null);
|
||||
Disposer.register(threadsContent, panel);
|
||||
threadsContent.setCloseable(false);
|
||||
ui.addContent(threadsContent, 0, PlaceInGrid.left, true);
|
||||
ui.addListener(new ContentManagerAdapter() {
|
||||
@Override
|
||||
public void selectionChanged(ContentManagerEvent event) {
|
||||
if (event.getContent() == threadsContent) {
|
||||
if (threadsContent.isSelected()) {
|
||||
panel.setUpdateEnabled(true);
|
||||
if (panel.isRefreshNeeded()) {
|
||||
panel.rebuildIfVisible(DebuggerSession.EVENT_CONTEXT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
panel.setUpdateEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, threadsContent);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar) {
|
||||
Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
|
||||
leftToolbar.add(Separator.getInstance(), beforeRunner);
|
||||
leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.EXPORT_THREADS), beforeRunner);
|
||||
leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
|
||||
leftToolbar.add(Separator.getInstance(), beforeRunner);
|
||||
|
||||
final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
|
||||
e.getPresentation().setIcon(AllIcons.General.SecondaryGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDumbAware() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
settings.add(new WatchLastMethodReturnValueAction());
|
||||
settings.add(new AutoVarsSwitchAction());
|
||||
settings.add(new UnmuteOnStopAction());
|
||||
settings.addSeparator();
|
||||
addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
|
||||
|
||||
leftToolbar.add(settings, new Constraints(Anchor.AFTER, "Runner.Layout"));
|
||||
}
|
||||
|
||||
private static class AutoVarsSwitchAction extends ToggleAction {
|
||||
private volatile boolean myAutoModeEnabled;
|
||||
|
||||
public AutoVarsSwitchAction() {
|
||||
super("", "", AllIcons.Debugger.AutoVariablesMode);
|
||||
myAutoModeEnabled = DebuggerSettings.getInstance().AUTO_VARIABLES_MODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean autoModeEnabled = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(autoModeEnabled ? "All-Variables Mode" : "Auto-Variables Mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return myAutoModeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myAutoModeEnabled = enabled;
|
||||
DebuggerSettings.getInstance().AUTO_VARIABLES_MODE = enabled;
|
||||
XDebuggerUtilImpl.rebuildAllSessionsViews(e.getProject());
|
||||
}
|
||||
}
|
||||
|
||||
private static class WatchLastMethodReturnValueAction extends ToggleAction {
|
||||
private volatile boolean myWatchesReturnValues;
|
||||
private final String myTextEnable;
|
||||
private final String myTextUnavailable;
|
||||
private final String myMyTextDisable;
|
||||
|
||||
public WatchLastMethodReturnValueAction() {
|
||||
super("", DebuggerBundle.message("action.watch.method.return.value.description"), null);
|
||||
myWatchesReturnValues = DebuggerSettings.getInstance().WATCH_RETURN_VALUES;
|
||||
myTextEnable = DebuggerBundle.message("action.watches.method.return.value.enable");
|
||||
myMyTextDisable = DebuggerBundle.message("action.watches.method.return.value.disable");
|
||||
myTextUnavailable = DebuggerBundle.message("action.watches.method.return.value.unavailable.reason");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean watchValues = (Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
|
||||
final String actionText = watchValues ? myMyTextDisable : myTextEnable;
|
||||
if (process == null || process.canGetMethodReturnValue()) {
|
||||
presentation.setEnabled(true);
|
||||
presentation.setText(actionText);
|
||||
}
|
||||
else {
|
||||
presentation.setEnabled(false);
|
||||
presentation.setText(myTextUnavailable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return myWatchesReturnValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean watch) {
|
||||
myWatchesReturnValues = watch;
|
||||
DebuggerSettings.getInstance().WATCH_RETURN_VALUES = watch;
|
||||
DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
|
||||
if (process != null) {
|
||||
process.setWatchMethodReturnValuesEnabled(watch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static DebugProcessImpl getCurrentDebugProcess(@Nullable Project project) {
|
||||
if (project != null) {
|
||||
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
|
||||
if (session != null) {
|
||||
XDebugProcess process = session.getDebugProcess();
|
||||
if (process instanceof JavaDebugProcess) {
|
||||
return ((JavaDebugProcess)process).getDebuggerSession().getProcess();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void addActionToGroup(final DefaultActionGroup group, final String actionId) {
|
||||
AnAction action = ActionManager.getInstance().getAction(actionId);
|
||||
if (action != null) group.add(action);
|
||||
}
|
||||
|
||||
public NodeManagerImpl getNodeManager() {
|
||||
return myNodeManager;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XValueMarkerProvider<?, ?> createValueMarkerProvider() {
|
||||
return new JavaValueMarker();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
import com.intellij.debugger.impl.EditorTextProvider;
|
||||
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaDebuggerEvaluator extends XDebuggerEvaluator {
|
||||
private final DebugProcessImpl myDebugProcess;
|
||||
private final JavaStackFrame myStackFrame;
|
||||
|
||||
public JavaDebuggerEvaluator(DebugProcessImpl debugProcess, JavaStackFrame stackFrame) {
|
||||
myDebugProcess = debugProcess;
|
||||
myStackFrame = stackFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate(@NotNull final String expression,
|
||||
@NotNull final XEvaluationCallback callback,
|
||||
@Nullable XSourcePosition expressionPosition) {
|
||||
evaluate(XExpressionImpl.fromText(expression), callback, expressionPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate(@NotNull final XExpression expression,
|
||||
@NotNull final XEvaluationCallback callback,
|
||||
@Nullable XSourcePosition expressionPosition) {
|
||||
myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext()) {
|
||||
@Override
|
||||
public void threadAction() {
|
||||
WatchItemDescriptor descriptor = new WatchItemDescriptor(myDebugProcess.getProject(), TextWithImportsImpl.fromXExpression(
|
||||
expression));
|
||||
EvaluationContextImpl evalContext = myStackFrame.getFrameDebuggerContext().createEvaluationContext();
|
||||
if (evalContext == null) {
|
||||
callback.errorOccurred("Context is not available");
|
||||
return;
|
||||
}
|
||||
descriptor.setContext(evalContext);
|
||||
descriptor.updateRepresentation(evalContext, DescriptorLabelListener.DUMMY_LISTENER);
|
||||
JavaDebugProcess process = myDebugProcess.getXdebugProcess();
|
||||
if (process != null) {
|
||||
callback.evaluated(new JavaValue(descriptor, evalContext, process.getNodeManager()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TextRange getExpressionRangeAtOffset(final Project project, final Document document, final int offset, final boolean sideEffectsAllowed) {
|
||||
final Ref<TextRange> currentRange = Ref.create(null);
|
||||
PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile == null) {
|
||||
return;
|
||||
}
|
||||
PsiElement elementAtCursor = psiFile.findElementAt(offset);
|
||||
if (elementAtCursor == null) {
|
||||
return;
|
||||
}
|
||||
Pair<PsiElement, TextRange> pair = findExpression(elementAtCursor, sideEffectsAllowed);
|
||||
if (pair != null) {
|
||||
currentRange.set(pair.getSecond());
|
||||
}
|
||||
}
|
||||
});
|
||||
return currentRange.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Pair<PsiElement, TextRange> findExpression(PsiElement element, boolean allowMethodCalls) {
|
||||
final EditorTextProvider textProvider = EditorTextProvider.EP.forLanguage(element.getLanguage());
|
||||
if (textProvider != null) {
|
||||
return textProvider.findExpression(element, allowMethodCalls);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.ui.impl.watch.MethodsTracker;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaExecutionStack extends XExecutionStack {
|
||||
private final ThreadReferenceProxyImpl myThreadProxy;
|
||||
private final DebugProcessImpl myDebugProcess;
|
||||
private volatile JavaStackFrame myTopFrame;
|
||||
private boolean myTopFrameReady = false;
|
||||
private final MethodsTracker myTracker = new MethodsTracker();
|
||||
|
||||
public JavaExecutionStack(@NotNull ThreadReferenceProxyImpl threadProxy, @NotNull DebugProcessImpl debugProcess, boolean current) {
|
||||
super(calcRepresentation(threadProxy), current ? AllIcons.Debugger.ThreadCurrent : AllIcons.Debugger.ThreadSuspended);
|
||||
myThreadProxy = threadProxy;
|
||||
myDebugProcess = debugProcess;
|
||||
if (current) {
|
||||
myTopFrame = calcTopFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ThreadReferenceProxyImpl getThreadProxy() {
|
||||
return myThreadProxy;
|
||||
}
|
||||
|
||||
private JavaStackFrame calcTopFrame() {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
try {
|
||||
StackFrameProxyImpl frame = myThreadProxy.frame(0);
|
||||
if (frame != null) {
|
||||
return new JavaStackFrame(frame, myDebugProcess, myTracker);
|
||||
}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
myTopFrameReady = true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JavaStackFrame getTopFrame() {
|
||||
if (!myTopFrameReady) {
|
||||
//TODO: remove sync calculation
|
||||
myDebugProcess.getManagerThread().invokeAndWait(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
myTopFrame = calcTopFrame();
|
||||
}
|
||||
});
|
||||
}
|
||||
return myTopFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeStackFrames(final int firstFrameIndex, final XStackFrameContainer container) {
|
||||
myDebugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
boolean showLibraryStackframes = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
List<JavaStackFrame> frames = new ArrayList<JavaStackFrame>();
|
||||
if (!myThreadProxy.isCollected() && myDebugProcess.getSuspendManager().isSuspended(myThreadProxy)) {
|
||||
int status = myThreadProxy.status();
|
||||
if (!(status == ThreadReference.THREAD_STATUS_UNKNOWN) &&
|
||||
!(status == ThreadReference.THREAD_STATUS_NOT_STARTED) &&
|
||||
!(status == ThreadReference.THREAD_STATUS_ZOMBIE)) {
|
||||
try {
|
||||
int framesToSkip = firstFrameIndex;
|
||||
for (StackFrameProxyImpl stackFrame : myThreadProxy.frames()) {
|
||||
JavaStackFrame frame = new JavaStackFrame(stackFrame, myDebugProcess, myTracker);
|
||||
if (showLibraryStackframes || (!frame.getDescriptor().isSynthetic() && !frame.getDescriptor().isInLibraryContent())) {
|
||||
if (framesToSkip > 0) {
|
||||
framesToSkip--;
|
||||
continue;
|
||||
}
|
||||
frames.add(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
container.errorOccurred(e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
container.addStackFrames(frames, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String calcRepresentation(ThreadReferenceProxyImpl thread) {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
String name = thread.name();
|
||||
ThreadGroupReferenceProxyImpl gr = thread.threadGroupProxy();
|
||||
final String grname = (gr != null)? gr.name() : null;
|
||||
final String threadStatusText = DebuggerUtilsEx.getThreadStatusText(thread.status());
|
||||
//noinspection HardCodedStringLiteral
|
||||
if (grname != null && !"SYSTEM".equalsIgnoreCase(grname)) {
|
||||
return DebuggerBundle.message("label.thread.node.in.group", name, thread.uniqueID(), threadStatusText, grname);
|
||||
}
|
||||
return DebuggerBundle.message("label.thread.node", name, thread.uniqueID(), threadStatusText);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.ui.ColoredTextContainer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
|
||||
import com.sun.jdi.Method;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// Copied from FramesListRenderer
|
||||
class JavaFramesListRenderer /*extends ColoredListCellRenderer*/ {
|
||||
private final EditorColorsScheme myColorScheme;
|
||||
|
||||
public JavaFramesListRenderer() {
|
||||
myColorScheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
}
|
||||
|
||||
public void customizePresentation(StackFrameDescriptorImpl descriptor, @NotNull ColoredTextContainer component) {
|
||||
component.setIcon(descriptor.getIcon());
|
||||
//final Object selectedValue = list.getSelectedValue();
|
||||
//final boolean shouldHighlightAsRecursive = (selectedValue instanceof StackFrameDescriptorImpl) &&
|
||||
// isOccurrenceOfSelectedFrame((StackFrameDescriptorImpl)selectedValue, descriptor);
|
||||
|
||||
final ValueMarkup markup = descriptor.getValueMarkup();
|
||||
if (markup != null) {
|
||||
component.append("["+ markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
|
||||
}
|
||||
|
||||
boolean needSeparator = false;
|
||||
//if (index > 0) {
|
||||
// final int currentFrameIndex = descriptor.getUiIndex();
|
||||
// final Object elementAt = list.getModel().getElementAt(index - 1);
|
||||
// if (elementAt instanceof StackFrameDescriptorImpl) {
|
||||
// StackFrameDescriptorImpl previousDescriptor = (StackFrameDescriptorImpl)elementAt;
|
||||
// final int previousFrameIndex = previousDescriptor.getUiIndex();
|
||||
// needSeparator = (currentFrameIndex - previousFrameIndex != 1);
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (selected) {
|
||||
// setBackground(UIUtil.getListSelectionBackground());
|
||||
//}
|
||||
//else {
|
||||
// Color bg = descriptor.getBackgroundColor();
|
||||
// if (bg == null) bg = UIUtil.getListBackground();
|
||||
// if (shouldHighlightAsRecursive) bg = myColorScheme.getColor(DebuggerColors.RECURSIVE_CALL_ATTRIBUTES);
|
||||
// setBackground(bg);
|
||||
//}
|
||||
//
|
||||
//if (needSeparator) {
|
||||
// final MatteBorder border = BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.GRAY);
|
||||
// setBorder(border);
|
||||
//}
|
||||
//else {
|
||||
// setBorder(null);
|
||||
//}
|
||||
|
||||
final String label = descriptor.getLabel();
|
||||
final int openingBrace = label.indexOf("{");
|
||||
final int closingBrace = (openingBrace < 0) ? -1 : label.indexOf("}");
|
||||
final SimpleTextAttributes attributes = getAttributes(descriptor);
|
||||
if (openingBrace < 0 || closingBrace < 0) {
|
||||
component.append(label, attributes);
|
||||
}
|
||||
else {
|
||||
component.append(label.substring(0, openingBrace - 1), attributes);
|
||||
component.append(" (" + label.substring(openingBrace + 1, closingBrace) + ")", SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
|
||||
|
||||
component.append(label.substring(closingBrace + 1, label.length()), attributes);
|
||||
//if (shouldHighlightAsRecursive && descriptor.isRecursiveCall()) {
|
||||
// component.append(" [" + descriptor.getOccurrenceIndex() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOccurrenceOfSelectedFrame(final StackFrameDescriptorImpl selectedDescriptor, StackFrameDescriptorImpl descriptor) {
|
||||
final Method currentMethod = descriptor.getMethod();
|
||||
if (currentMethod != null) {
|
||||
if (selectedDescriptor != null) {
|
||||
final Method selectedMethod = selectedDescriptor.getMethod();
|
||||
if (selectedMethod != null) {
|
||||
if (Comparing.equal(selectedMethod, currentMethod)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static SimpleTextAttributes getAttributes(final StackFrameDescriptorImpl descriptor) {
|
||||
if (descriptor.isSynthetic() || descriptor.isInLibraryContent()) {
|
||||
return SimpleTextAttributes.GRAYED_ATTRIBUTES;
|
||||
}
|
||||
return SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.*;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.settings.ViewsGeneralSettings;
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.impl.FrameVariablesTree;
|
||||
import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.debugger.ui.tree.render.ClassRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.ColoredTextContainer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.frame.XCompositeNode;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenList;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.Event;
|
||||
import com.sun.jdi.event.ExceptionEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaStackFrame extends XStackFrame {
|
||||
private static final Logger LOG = Logger.getInstance(JavaStackFrame.class);
|
||||
|
||||
private final DebugProcessImpl myDebugProcess;
|
||||
private final XSourcePosition myXSourcePosition;
|
||||
private final SourcePosition mySourcePosition;
|
||||
private final NodeManagerImpl myNodeManager;
|
||||
private final StackFrameDescriptorImpl myDescriptor;
|
||||
private final JavaFramesListRenderer myRenderer = new JavaFramesListRenderer();
|
||||
private JavaDebuggerEvaluator myEvaluator = null;
|
||||
|
||||
public JavaStackFrame(@NotNull StackFrameProxyImpl stackFrameProxy, @NotNull DebugProcessImpl debugProcess, MethodsTracker tracker) {
|
||||
myDebugProcess = debugProcess;
|
||||
Pair<SourcePosition, XSourcePosition> positions = calcSourcePosition(stackFrameProxy);
|
||||
mySourcePosition = positions.getFirst();
|
||||
myXSourcePosition = positions.getSecond();
|
||||
myNodeManager = debugProcess.getXdebugProcess().getNodeManager();
|
||||
myDescriptor = new StackFrameDescriptorImpl(stackFrameProxy, tracker);
|
||||
myDescriptor.setContext(null);
|
||||
myDescriptor.updateRepresentation(null, DescriptorLabelListener.DUMMY_LISTENER);
|
||||
}
|
||||
|
||||
public StackFrameDescriptorImpl getDescriptor() {
|
||||
return myDescriptor;
|
||||
}
|
||||
|
||||
private Pair<SourcePosition, XSourcePosition> calcSourcePosition(StackFrameProxyImpl stackFrameProxy) {
|
||||
final CompoundPositionManager positionManager = myDebugProcess.getPositionManager();
|
||||
if (positionManager == null) {
|
||||
// process already closed
|
||||
return null;
|
||||
}
|
||||
Location location = null;
|
||||
try {
|
||||
location = stackFrameProxy.location();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.info(e);
|
||||
}
|
||||
final Location loc = location;
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Pair<SourcePosition, XSourcePosition>>() {
|
||||
@Override
|
||||
public Pair<SourcePosition, XSourcePosition> compute() {
|
||||
SourcePosition position = positionManager.getSourcePosition(loc);
|
||||
XSourcePosition xSourcePosition = position != null ? DebuggerUtilsEx.toXSourcePosition(position) : null;
|
||||
return new Pair<SourcePosition, XSourcePosition>(position, xSourcePosition);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XDebuggerEvaluator getEvaluator() {
|
||||
if (myEvaluator == null) {
|
||||
myEvaluator = new JavaDebuggerEvaluator(myDebugProcess, this);
|
||||
}
|
||||
return myEvaluator;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XSourcePosition getSourcePosition() {
|
||||
return myXSourcePosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customizePresentation(@NotNull ColoredTextContainer component) {
|
||||
myRenderer.customizePresentation(myDescriptor, component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeChildren(@NotNull final XCompositeNode node) {
|
||||
XStackFrame xFrame = getDescriptor().getXStackFrame();
|
||||
if (xFrame != null) {
|
||||
xFrame.computeChildren(node);
|
||||
return;
|
||||
}
|
||||
myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext()) {
|
||||
@Override
|
||||
public void threadAction() {
|
||||
XValueChildrenList children = new XValueChildrenList();
|
||||
buildVariablesThreadAction(getFrameDebuggerContext(), children, node);
|
||||
node.addChildren(children, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DebuggerContextImpl getFrameDebuggerContext() {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
DebuggerContextImpl context = myDebugProcess.getDebuggerContext();
|
||||
if (context.getFrameProxy() != getStackFrameProxy()) {
|
||||
context = DebuggerContextImpl.createDebuggerContext(
|
||||
myDebugProcess.mySession,
|
||||
context.getSuspendContext(),
|
||||
getStackFrameProxy().threadProxy(),
|
||||
getStackFrameProxy());
|
||||
context.setPositionCache(mySourcePosition);
|
||||
context.initCaches();
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
// copied from DebuggerTree
|
||||
private void buildVariablesThreadAction(DebuggerContextImpl debuggerContext, XValueChildrenList children, XCompositeNode node) {
|
||||
try {
|
||||
final StackFrameDescriptorImpl stackDescriptor = myDescriptor;
|
||||
final StackFrameProxyImpl frame = getStackFrameProxy();
|
||||
|
||||
final EvaluationContextImpl evaluationContext = debuggerContext.createEvaluationContext();
|
||||
if (!debuggerContext.isEvaluationPossible()) {
|
||||
node.setErrorMessage(MessageDescriptor.EVALUATION_NOT_POSSIBLE.getLabel());
|
||||
//myChildren.add(myNodeManager.createNode(MessageDescriptor.EVALUATION_NOT_POSSIBLE, evaluationContext));
|
||||
}
|
||||
|
||||
final Location location = frame.location();
|
||||
LOG.assertTrue(location != null);
|
||||
|
||||
final ObjectReference thisObjectReference = frame.thisObject();
|
||||
if (thisObjectReference != null) {
|
||||
ValueDescriptorImpl thisDescriptor = myNodeManager.getThisDescriptor(stackDescriptor, thisObjectReference);
|
||||
children.add(new JavaValue(thisDescriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
else {
|
||||
StaticDescriptorImpl staticDecriptor = myNodeManager.getStaticDescriptor(stackDescriptor, location.method().declaringType());
|
||||
if (staticDecriptor.isExpandable()) {
|
||||
children.addTopGroup(new JavaStaticGroup(staticDecriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
|
||||
// add last method return value if any
|
||||
final Pair<Method, Value> methodValuePair = debuggerContext.getDebugProcess().getLastExecutedMethod();
|
||||
if (methodValuePair != null) {
|
||||
ValueDescriptorImpl returnValueDescriptor = myNodeManager.getMethodReturnValueDescriptor(stackDescriptor, methodValuePair.getFirst(), methodValuePair.getSecond());
|
||||
children.add(new JavaValue(returnValueDescriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
// add context exceptions
|
||||
for (Pair<Breakpoint, Event> pair : DebuggerUtilsEx.getEventDescriptors(debuggerContext.getSuspendContext())) {
|
||||
final Event debugEvent = pair.getSecond();
|
||||
if (debugEvent instanceof ExceptionEvent) {
|
||||
final ObjectReference exception = ((ExceptionEvent)debugEvent).exception();
|
||||
if (exception != null) {
|
||||
final ValueDescriptorImpl exceptionDescriptor = myNodeManager.getThrownExceptionObjectDescriptor(stackDescriptor, exception);
|
||||
children.add(new JavaValue(exceptionDescriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
|
||||
if (classRenderer.SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES) {
|
||||
if (thisObjectReference != null && evaluationContext.getDebugProcess().getVirtualMachineProxy().canGetSyntheticAttribute()) {
|
||||
final ReferenceType thisRefType = thisObjectReference.referenceType();
|
||||
if (thisRefType instanceof ClassType && thisRefType.equals(location.declaringType()) && thisRefType.name().contains("$")) { // makes sense for nested classes only
|
||||
final ClassType clsType = (ClassType)thisRefType;
|
||||
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
|
||||
final VirtualMachineProxyImpl vm = debugProcess.getVirtualMachineProxy();
|
||||
for (Field field : clsType.fields()) {
|
||||
if ((!vm.canGetSyntheticAttribute() || field.isSynthetic()) && StringUtil
|
||||
.startsWith(field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) {
|
||||
final FieldDescriptorImpl fieldDescriptor = myNodeManager.getFieldDescriptor(stackDescriptor, thisObjectReference, field);
|
||||
children.add(new JavaValue(fieldDescriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
buildVariables(debuggerContext, evaluationContext, children, node);
|
||||
//if (classRenderer.SORT_ASCENDING) {
|
||||
// Collections.sort(myChildren, NodeManagerImpl.getNodeComparator());
|
||||
//}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
node.setErrorMessage(e.getMessage());
|
||||
//myChildren.add(myNodeManager.createMessageNode(new MessageDescriptor(e.getMessage())));
|
||||
}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
node.setErrorMessage(e.getMessage());
|
||||
//myChildren.clear();
|
||||
//myChildren.add(myNodeManager.createMessageNode(new MessageDescriptor(e.getMessage())));
|
||||
}
|
||||
catch (InvalidStackFrameException e) {
|
||||
LOG.info(e);
|
||||
//myChildren.clear();
|
||||
//notifyCancelled();
|
||||
}
|
||||
catch (InternalException e) {
|
||||
if (e.errorCode() == 35) {
|
||||
node.setErrorMessage(DebuggerBundle.message("error.corrupt.debug.info", e.getMessage()));
|
||||
//myChildren.add(
|
||||
// myNodeManager.createMessageNode(new MessageDescriptor(DebuggerBundle.message("error.corrupt.debug.info", e.getMessage()))));
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copied from FrameVariablesTree
|
||||
private void buildVariables(DebuggerContextImpl debuggerContext, EvaluationContextImpl evaluationContext, XValueChildrenList children, XCompositeNode node) throws EvaluateException {
|
||||
boolean myAutoWatchMode = DebuggerSettings.getInstance().AUTO_VARIABLES_MODE;
|
||||
if (evaluationContext == null) {
|
||||
return;
|
||||
}
|
||||
final SourcePosition sourcePosition = debuggerContext.getSourcePosition();
|
||||
if (sourcePosition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!ViewsGeneralSettings.getInstance().ENABLE_AUTO_EXPRESSIONS && !myAutoWatchMode) {
|
||||
// optimization
|
||||
superBuildVariables(evaluationContext, children);
|
||||
}
|
||||
else {
|
||||
final Map<String, LocalVariableProxyImpl> visibleVariables = FrameVariablesTree.getVisibleVariables(getStackFrameProxy());
|
||||
final EvaluationContextImpl evalContext = evaluationContext;
|
||||
final Pair<Set<String>, Set<TextWithImports>> usedVars =
|
||||
ApplicationManager.getApplication().runReadAction(new Computable<Pair<Set<String>, Set<TextWithImports>>>() {
|
||||
@Override
|
||||
public Pair<Set<String>, Set<TextWithImports>> compute() {
|
||||
return FrameVariablesTree.findReferencedVars(visibleVariables.keySet(), sourcePosition, evalContext);
|
||||
}
|
||||
});
|
||||
// add locals
|
||||
if (myAutoWatchMode) {
|
||||
for (String var : usedVars.first) {
|
||||
final LocalVariableDescriptorImpl descriptor = myNodeManager.getLocalVariableDescriptor(null, visibleVariables.get(var));
|
||||
children.add(new JavaValue(descriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
else {
|
||||
superBuildVariables(evaluationContext, children);
|
||||
}
|
||||
// add expressions
|
||||
final EvaluationContextImpl evalContextCopy = evaluationContext.createEvaluationContext(evaluationContext.getThisObject());
|
||||
evalContextCopy.setAutoLoadClasses(false);
|
||||
for (TextWithImports text : usedVars.second) {
|
||||
WatchItemDescriptor descriptor = myNodeManager.getWatchItemDescriptor(null, text, null);
|
||||
children.add(new JavaValue(descriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
if (e.getCause() instanceof AbsentInformationException) {
|
||||
final StackFrameProxyImpl frame = getStackFrameProxy();
|
||||
|
||||
final Collection<Value> argValues = frame.getArgumentValues();
|
||||
int index = 0;
|
||||
for (Value argValue : argValues) {
|
||||
final ArgumentValueDescriptorImpl descriptor = myNodeManager.getArgumentValueDescriptor(null, index++, argValue, null);
|
||||
children.add(new JavaValue(descriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
node.setMessage(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE.getLabel(), XDebuggerUIConstants.INFORMATION_MESSAGE_ICON, SimpleTextAttributes.REGULAR_ATTRIBUTES, null);
|
||||
//myChildren.add(myNodeManager.createMessageNode(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE));
|
||||
|
||||
// trying to collect values from variable slots
|
||||
final List<DecompiledLocalVariable> decompiled = FrameVariablesTree.collectVariablesFromBytecode(frame, argValues.size());
|
||||
if (!decompiled.isEmpty()) {
|
||||
try {
|
||||
final Map<DecompiledLocalVariable, Value> values = LocalVariablesUtil.fetchValues(frame.getStackFrame(), decompiled);
|
||||
for (DecompiledLocalVariable var : decompiled) {
|
||||
final Value value = values.get(var);
|
||||
final ArgumentValueDescriptorImpl descriptor = myNodeManager.getArgumentValueDescriptor(null, var.getSlot(), value, var.getName());
|
||||
children.add(new JavaValue(descriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
LOG.info(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void superBuildVariables(final EvaluationContextImpl evaluationContext, XValueChildrenList children) throws EvaluateException {
|
||||
final StackFrameProxyImpl frame = getStackFrameProxy();
|
||||
for (final LocalVariableProxyImpl local : frame.visibleVariables()) {
|
||||
final LocalVariableDescriptorImpl descriptor = myNodeManager.getLocalVariableDescriptor(null, local);
|
||||
children.add(new JavaValue(descriptor, evaluationContext, myNodeManager));
|
||||
}
|
||||
}
|
||||
|
||||
public StackFrameProxyImpl getStackFrameProxy() {
|
||||
return myDescriptor.getFrameProxy();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getEqualityObject() {
|
||||
return getStackFrameProxy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.xdebugger.frame.*;
|
||||
import com.sun.jdi.Field;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaStaticGroup extends XValueGroup implements NodeDescriptorProvider {
|
||||
private final StaticDescriptorImpl myStaticDescriptor;
|
||||
private final EvaluationContextImpl myEvaluationContext;
|
||||
private final NodeManagerImpl myNodeManager;
|
||||
|
||||
public JavaStaticGroup(StaticDescriptorImpl staticDescriptor,
|
||||
EvaluationContextImpl evaluationContext,
|
||||
NodeManagerImpl nodeManager) {
|
||||
super(staticDescriptor.getName());
|
||||
myStaticDescriptor = staticDescriptor;
|
||||
myEvaluationContext = evaluationContext;
|
||||
myNodeManager = nodeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeDescriptorImpl getDescriptor() {
|
||||
return myStaticDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeChildren(@NotNull final XCompositeNode node) {
|
||||
myEvaluationContext.getDebugProcess().getManagerThread().schedule(
|
||||
new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
final XValueChildrenList children = new XValueChildrenList();
|
||||
|
||||
final ReferenceType refType = myStaticDescriptor.getType();
|
||||
List<Field> fields = refType.allFields();
|
||||
for (Field field : fields) {
|
||||
if (field.isStatic()) {
|
||||
final FieldDescriptorImpl fieldDescriptor = myNodeManager.getFieldDescriptor(myStaticDescriptor, null, field);
|
||||
children.add(new JavaValue(fieldDescriptor, myEvaluationContext, myNodeManager));
|
||||
//final DebuggerTreeNodeImpl node = myNodeManager.createNode(fieldDescriptor, myEvaluationContext);
|
||||
//myChildren.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
node.addChildren(children, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.actions.JavaValueModifier;
|
||||
import com.intellij.debugger.actions.JumpToObjectAction;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.debugger.ui.tree.*;
|
||||
import com.intellij.debugger.ui.tree.render.ArrayRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.ChildrenBuilder;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.debugger.ui.tree.render.NodeRenderer;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.xdebugger.frame.*;
|
||||
import com.intellij.xdebugger.frame.presentation.XRegularValuePresentation;
|
||||
import com.intellij.xdebugger.frame.presentation.XStringValuePresentation;
|
||||
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
|
||||
import com.sun.jdi.Type;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
|
||||
private final JavaValue myParent;
|
||||
private final ValueDescriptorImpl myValueDescriptor;
|
||||
private final EvaluationContextImpl myEvaluationContext;
|
||||
private final NodeManagerImpl myNodeManager;
|
||||
|
||||
JavaValue(ValueDescriptorImpl valueDescriptor, EvaluationContextImpl evaluationContext, NodeManagerImpl nodeManager) {
|
||||
this(null, valueDescriptor, evaluationContext, nodeManager);
|
||||
}
|
||||
|
||||
JavaValue(JavaValue parent, ValueDescriptorImpl valueDescriptor, EvaluationContextImpl evaluationContext, NodeManagerImpl nodeManager) {
|
||||
super(valueDescriptor.getName());
|
||||
myParent = parent;
|
||||
myValueDescriptor = valueDescriptor;
|
||||
myEvaluationContext = evaluationContext;
|
||||
myNodeManager = nodeManager;
|
||||
}
|
||||
|
||||
public JavaValue getParent() {
|
||||
return myParent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueDescriptorImpl getDescriptor() {
|
||||
return myValueDescriptor;
|
||||
}
|
||||
|
||||
public EvaluationContextImpl getEvaluationContext() {
|
||||
return myEvaluationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computePresentation(@NotNull final XValueNode node, @NotNull XValuePlace place) {
|
||||
if (myEvaluationContext.getSuspendContext().isResumed()) return;
|
||||
myEvaluationContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(getDebuggerContext()) {
|
||||
@Override
|
||||
public void threadAction() {
|
||||
myValueDescriptor.setContext(myEvaluationContext);
|
||||
myValueDescriptor.updateRepresentation(myEvaluationContext, new DescriptorLabelListener() {
|
||||
@Override
|
||||
public void labelChanged() {
|
||||
Type type = myValueDescriptor.getType();
|
||||
String typeName = type != null ? type.name() : null;
|
||||
|
||||
Icon nodeIcon;
|
||||
if (myValueDescriptor instanceof FieldDescriptorImpl && ((FieldDescriptorImpl)myValueDescriptor).isStatic()) {
|
||||
nodeIcon = PlatformIcons.FIELD_ICON;
|
||||
}
|
||||
else if (myValueDescriptor.isArray()) {
|
||||
nodeIcon = AllIcons.Debugger.Db_array;
|
||||
}
|
||||
else if (myValueDescriptor.isPrimitive()) {
|
||||
nodeIcon = AllIcons.Debugger.Db_primitive;
|
||||
}
|
||||
else {
|
||||
if (myValueDescriptor instanceof WatchItemDescriptor) {
|
||||
nodeIcon = AllIcons.Debugger.Watch;
|
||||
}
|
||||
else {
|
||||
nodeIcon = AllIcons.Debugger.Value;
|
||||
}
|
||||
}
|
||||
final String[] strings = splitValue(myValueDescriptor.getValueLabel());
|
||||
XValuePresentation presentation = new XRegularValuePresentation(strings[1], strings[0]);
|
||||
if (myValueDescriptor.isString()) {
|
||||
presentation = new TypedStringValuePresentation(StringUtil.unquoteString(strings[1]), strings[0]);
|
||||
}
|
||||
node.setPresentation(nodeIcon, presentation, myValueDescriptor.isExpandable());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class TypedStringValuePresentation extends XStringValuePresentation {
|
||||
private final String myType;
|
||||
|
||||
public TypedStringValuePresentation(@NotNull String value, @Nullable String type) {
|
||||
super(value);
|
||||
myType = type;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getType() {
|
||||
return myType;
|
||||
}
|
||||
}
|
||||
|
||||
private static String[] splitValue(String value) {
|
||||
if (StringUtil.startsWithChar(value, '{')) {
|
||||
int end = value.indexOf('}');
|
||||
if (end > 0) {
|
||||
return new String[]{value.substring(1, end-1), value.substring(end+1)};
|
||||
}
|
||||
}
|
||||
return new String[]{null, value};
|
||||
}
|
||||
|
||||
private int currentStart = 0;
|
||||
|
||||
@Override
|
||||
public void computeChildren(@NotNull final XCompositeNode node) {
|
||||
if (myEvaluationContext.getSuspendContext().isResumed()) return;
|
||||
myEvaluationContext.getDebugProcess().getManagerThread().schedule(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
final XValueChildrenList children = new XValueChildrenList();
|
||||
final NodeRenderer renderer = myValueDescriptor.getRenderer(myEvaluationContext.getDebugProcess());
|
||||
if (renderer instanceof ArrayRenderer) {
|
||||
((ArrayRenderer)renderer).START_INDEX = currentStart;
|
||||
((ArrayRenderer)renderer).END_INDEX = currentStart + XCompositeNode.MAX_CHILDREN_TO_SHOW - 1;
|
||||
currentStart += XCompositeNode.MAX_CHILDREN_TO_SHOW;
|
||||
}
|
||||
final Ref<Integer> remainingNum = new Ref<Integer>(0);
|
||||
renderer.buildChildren(myValueDescriptor.getValue(), new ChildrenBuilder() {
|
||||
@Override
|
||||
public NodeDescriptorFactory getDescriptorManager() {
|
||||
return myNodeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeManager getNodeManager() {
|
||||
return myNodeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueDescriptor getParentDescriptor() {
|
||||
return myValueDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemaining(int remaining) {
|
||||
remainingNum.set(remaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChildren(List<DebuggerTreeNode> nodes) {
|
||||
for (DebuggerTreeNode node : nodes) {
|
||||
final NodeDescriptor descriptor = node.getDescriptor();
|
||||
if (descriptor instanceof ValueDescriptorImpl) {
|
||||
children.add(new JavaValue(JavaValue.this, (ValueDescriptorImpl)descriptor, myEvaluationContext, myNodeManager));
|
||||
}
|
||||
else if (descriptor instanceof MessageDescriptor) {
|
||||
children.add("", new XValue() {
|
||||
@Override
|
||||
public void computePresentation(@NotNull XValueNode node, @NotNull XValuePlace place) {
|
||||
node.setPresentation(null, new XValuePresentation() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getSeparator() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderValue(@NotNull XValueTextRenderer renderer) {
|
||||
renderer.renderValue(descriptor.getLabel());
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, myEvaluationContext);
|
||||
node.addChildren(children, true);
|
||||
if (remainingNum.get() > 0) {
|
||||
node.tooManyChildren(remainingNum.get());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeSourcePosition(@NotNull XNavigatable navigatable) {
|
||||
if (myValueDescriptor instanceof FieldDescriptorImpl) {
|
||||
SourcePosition position = ((FieldDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
|
||||
if (position != null) {
|
||||
navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
|
||||
}
|
||||
}
|
||||
if (myValueDescriptor instanceof LocalVariableDescriptorImpl) {
|
||||
SourcePosition position = ((LocalVariableDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
|
||||
if (position != null) {
|
||||
navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DebuggerContextImpl getDebuggerContext() {
|
||||
return myEvaluationContext.getDebugProcess().getDebuggerContext();
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return myEvaluationContext.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigateToTypeSource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeTypeSourcePosition(@NotNull final XNavigatable navigatable) {
|
||||
if (myEvaluationContext.getSuspendContext().isResumed()) return;
|
||||
DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
|
||||
debugProcess.getManagerThread().schedule(new JumpToObjectAction.NavigateCommand(getDebuggerContext(), myValueDescriptor, debugProcess, null) {
|
||||
@Override
|
||||
protected void doAction(@Nullable final SourcePosition sourcePosition) {
|
||||
if (sourcePosition != null) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(sourcePosition));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XValueModifier getModifier() {
|
||||
return myValueDescriptor.canSetValue() ? new JavaValueModifier(this) : null;
|
||||
}
|
||||
|
||||
|
||||
private volatile String evaluationExpression = null;
|
||||
@Nullable
|
||||
@Override
|
||||
public String getEvaluationExpression() {
|
||||
if (evaluationExpression == null) {
|
||||
// TODO: change API to allow to calculate it asynchronously
|
||||
DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
|
||||
debugProcess.getManagerThread().invokeAndWait(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
evaluationExpression = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
try {
|
||||
return new TextWithImportsImpl(getDescriptor().getTreeEvaluation(JavaValue.this, getDebuggerContext())).getText();
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return evaluationExpression;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.xdebugger.frame.XValueMarkerProvider;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaValueMarker extends XValueMarkerProvider<JavaValue, Long> {
|
||||
public JavaValueMarker() {
|
||||
super(JavaValue.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMark(@NotNull JavaValue value) {
|
||||
Value obj = value.getDescriptor().getValue();
|
||||
return obj instanceof ObjectReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getMarker(@NotNull JavaValue value) {
|
||||
Value obj = value.getDescriptor().getValue();
|
||||
if (obj instanceof ObjectReference) {
|
||||
return ((ObjectReference)obj).uniqueID();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
@@ -31,13 +33,15 @@ import com.sun.jdi.request.EventRequest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* @author lex
|
||||
*/
|
||||
public abstract class SuspendContextImpl implements SuspendContext {
|
||||
public abstract class SuspendContextImpl extends XSuspendContext implements SuspendContext {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.SuspendContextImpl");
|
||||
|
||||
private final DebugProcessImpl myDebugProcess;
|
||||
@@ -57,6 +61,8 @@ public abstract class SuspendContextImpl implements SuspendContext {
|
||||
private final HashSet<ObjectReference> myKeptReferences = new HashSet<ObjectReference>();
|
||||
private EvaluationContextImpl myEvaluationContext = null;
|
||||
|
||||
private JavaExecutionStack[] myExecutionStacks;
|
||||
|
||||
SuspendContextImpl(@NotNull DebugProcessImpl debugProcess, int suspendPolicy, int eventVotes, EventSet set) {
|
||||
myDebugProcess = debugProcess;
|
||||
mySuspendPolicy = suspendPolicy;
|
||||
@@ -221,4 +227,30 @@ public abstract class SuspendContextImpl implements SuspendContext {
|
||||
public final SuspendContextCommandImpl pollPostponedCommand() {
|
||||
return myPostponedCommands.poll();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XExecutionStack getActiveExecutionStack() {
|
||||
for (JavaExecutionStack stack : myExecutionStacks) {
|
||||
if (stack.getThreadProxy().equals(myThread)) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XExecutionStack[] getExecutionStacks() {
|
||||
return myExecutionStacks;
|
||||
}
|
||||
|
||||
public void initExecutionStacks() {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
Collection<JavaExecutionStack> res = new ArrayList<JavaExecutionStack>();
|
||||
Collection<ThreadReferenceProxyImpl> threads = getDebugProcess().getVirtualMachineProxy().allThreads();
|
||||
for (ThreadReferenceProxyImpl thread : threads) {
|
||||
res.add(new JavaExecutionStack(thread, myDebugProcess, thread == myThread));
|
||||
}
|
||||
myExecutionStacks = res.toArray(new JavaExecutionStack[res.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
class UnmuteOnStopAction extends ToggleAction {
|
||||
private volatile boolean myUnmuteOnStop;
|
||||
|
||||
UnmuteOnStopAction() {
|
||||
super(DebuggerBundle.message("action.unmute.on.stop.text"), DebuggerBundle.message("action.unmute.on.stop.text"), null);
|
||||
myUnmuteOnStop = DebuggerSettings.getInstance().UNMUTE_ON_STOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return myUnmuteOnStop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
myUnmuteOnStop = state;
|
||||
DebuggerSettings.getInstance().UNMUTE_ON_STOP = state;
|
||||
}
|
||||
}
|
||||
+45
@@ -26,6 +26,10 @@ import com.intellij.psi.JavaCodeFragment;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiExpressionCodeFragment;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.evaluation.EvaluationMode;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerEditorBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -130,4 +134,45 @@ public final class TextWithImportsImpl implements TextWithImports{
|
||||
public FileType getFileType() {
|
||||
return myFileType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static XExpression toXExpression(TextWithImports text) {
|
||||
if (!text.getText().isEmpty()) {
|
||||
return new XExpressionImpl(text.getText(),
|
||||
XDebuggerEditorBase.getFileTypeLanguage(text.getFileType()),
|
||||
StringUtil.nullize(text.getImports()),
|
||||
getMode(text.getKind()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static EvaluationMode getMode(CodeFragmentKind kind) {
|
||||
switch (kind) {
|
||||
case EXPRESSION: return EvaluationMode.EXPRESSION;
|
||||
case CODE_BLOCK: return EvaluationMode.CODE_FRAGMENT;
|
||||
}
|
||||
throw new IllegalStateException("Unknown kind " + kind);
|
||||
}
|
||||
|
||||
private static CodeFragmentKind getKind(EvaluationMode mode) {
|
||||
switch (mode) {
|
||||
case EXPRESSION: return CodeFragmentKind.EXPRESSION;
|
||||
case CODE_FRAGMENT: return CodeFragmentKind.CODE_BLOCK;
|
||||
}
|
||||
throw new IllegalStateException("Unknown mode " + mode);
|
||||
}
|
||||
|
||||
public static TextWithImports fromXExpression(@Nullable XExpression expression) {
|
||||
if (expression == null) return null;
|
||||
|
||||
if (expression.getCustomInfo() == null && expression.getLanguage() == null) {
|
||||
return new TextWithImportsImpl(getKind(expression.getMode()), expression.getExpression());
|
||||
}
|
||||
else {
|
||||
return new TextWithImportsImpl(getKind(expression.getMode()),
|
||||
expression.getExpression(),
|
||||
StringUtil.notNullize(expression.getCustomInfo()),
|
||||
expression.getLanguage() != null ? expression.getLanguage().getAssociatedFileType() : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-9
@@ -28,7 +28,6 @@ import com.intellij.debugger.requests.RequestManager;
|
||||
import com.intellij.debugger.requests.Requestor;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
|
||||
import com.intellij.debugger.ui.breakpoints.FilteredRequestor;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -38,6 +37,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.ClassPrepareEvent;
|
||||
import com.sun.jdi.request.*;
|
||||
@@ -395,15 +395,24 @@ public class RequestManagerImpl extends DebugProcessAdapterImpl implements Reque
|
||||
// invoke later, so that requests are for sure created only _after_ 'processAttached()' methods of other listeners are executed
|
||||
process.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
protected void action() throws Exception {
|
||||
Project project = myDebugProcess.getProject();
|
||||
final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
|
||||
for (final Breakpoint breakpoint : breakpointManager.getBreakpoints()) {
|
||||
try {
|
||||
breakpoint.createRequest(myDebugProcess);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e);
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XDebugSession session = myDebugProcess.getXDebugSession();
|
||||
if (session != null) {
|
||||
session.initBreakpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//Project project = myDebugProcess.getProject();
|
||||
//final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
|
||||
//for (final Breakpoint breakpoint : breakpointManager.getBreakpoints()) {
|
||||
// try {
|
||||
// breakpoint.createRequest(myDebugProcess);
|
||||
// } catch (Exception e) {
|
||||
// LOG.error(e);
|
||||
// }
|
||||
//}
|
||||
|
||||
//AccessToken token = ReadAction.start();
|
||||
//try {
|
||||
|
||||
@@ -127,6 +127,7 @@ public final class DebuggerContextImpl implements DebuggerContext {
|
||||
return new EvaluationContextImpl(getSuspendContext(), getFrameProxy(), thisObject);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EvaluationContextImpl createEvaluationContext() {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
StackFrameProxyImpl frameProxy = getFrameProxy();
|
||||
@@ -138,7 +139,8 @@ public final class DebuggerContextImpl implements DebuggerContext {
|
||||
LOG.info(e);
|
||||
objectReference = null;
|
||||
}
|
||||
return new EvaluationContextImpl(getSuspendContext(), frameProxy, objectReference);
|
||||
SuspendContextImpl context = getSuspendContext();
|
||||
return context != null ? new EvaluationContextImpl(context, frameProxy, objectReference) : null;
|
||||
}
|
||||
|
||||
public static DebuggerContextImpl createDebuggerContext(@Nullable DebuggerSession session,
|
||||
@@ -178,7 +180,7 @@ public final class DebuggerContextImpl implements DebuggerContext {
|
||||
}
|
||||
|
||||
public void setPositionCache(SourcePosition position) {
|
||||
LOG.assertTrue(!myInitialized, "Debugger context is initialized. Cannot change caches");
|
||||
//LOG.assertTrue(!myInitialized, "Debugger context is initialized. Cannot change caches");
|
||||
mySourcePosition = position;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
@@ -44,6 +45,8 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.impl.XSourcePositionImpl;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.Event;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
@@ -617,4 +620,8 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
return text.replace("\t", StringUtil.repeat(" ", tabSize));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static XSourcePosition toXSourcePosition(@NotNull SourcePosition position) {
|
||||
return XSourcePositionImpl.create(position.getFile().getVirtualFile(), position.getLine());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,14 @@
|
||||
*/
|
||||
package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.DebugEnvironment;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.DefaultDebugUIEnvironment;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.ui.DebuggerPanelsManager;
|
||||
import com.intellij.debugger.ui.tree.render.BatchEvaluator;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.*;
|
||||
@@ -29,6 +34,10 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -77,12 +86,44 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected RunContentDescriptor attachVirtualMachine(Project project, RunProfileState state,
|
||||
protected RunContentDescriptor attachVirtualMachine(final Project project, RunProfileState state,
|
||||
RunContentDescriptor contentToReuse,
|
||||
ExecutionEnvironment env, RemoteConnection connection, boolean pollConnection)
|
||||
throws ExecutionException {
|
||||
final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(project);
|
||||
return manager.attachVirtualMachine(env.getExecutor(), this, env, state, contentToReuse, connection, pollConnection);
|
||||
DefaultDebugUIEnvironment debugEnvironment = new DefaultDebugUIEnvironment(project,
|
||||
env.getExecutor(),
|
||||
this,
|
||||
env,
|
||||
state,
|
||||
contentToReuse,
|
||||
connection,
|
||||
pollConnection);
|
||||
DebugEnvironment environment = debugEnvironment.getEnvironment();
|
||||
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).attachVirtualMachine(environment);
|
||||
if (debuggerSession == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final DebugProcessImpl debugProcess = debuggerSession.getProcess();
|
||||
if (debugProcess.isDetached() || debugProcess.isDetaching()) {
|
||||
debuggerSession.dispose();
|
||||
return null;
|
||||
}
|
||||
if (environment.isRemote()) {
|
||||
// optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
|
||||
// which is an expensive operation when executed first time
|
||||
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
|
||||
}
|
||||
|
||||
XDebugSession debugSession =
|
||||
XDebuggerManager.getInstance(project).startSession(this, env, contentToReuse, new XDebugProcessStarter() {
|
||||
@Override
|
||||
@NotNull
|
||||
public XDebugProcess start(@NotNull XDebugSession session) {
|
||||
return new JavaDebugProcess(session, debuggerSession);
|
||||
}
|
||||
});
|
||||
return debugSession.getRunContentDescriptor();
|
||||
}
|
||||
|
||||
private static RemoteConnection createRemoteDebugConnection(RemoteState connection, final RunnerSettings settings) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.openapi.options.BaseConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Iterator;
|
||||
@@ -66,6 +67,7 @@ public class ThreadsViewConfigurable extends BaseConfigurable {
|
||||
for (Iterator iterator = (DebuggerManagerEx.getInstanceEx(project)).getSessions().iterator(); iterator.hasNext();) {
|
||||
((DebuggerSession)iterator.next()).refresh(false);
|
||||
}
|
||||
XDebuggerUtilImpl.rebuildAllSessionsViews(project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentFactoryContextWrapper;
|
||||
import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.*;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
@@ -272,7 +269,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{
|
||||
|
||||
public void addRecent(TextWithImports text) {
|
||||
if(getRecentsId() != null && text != null && !text.isEmpty()){
|
||||
XDebuggerHistoryManager.getInstance(getProject()).addRecentExpression(getRecentsId(), text.getText());
|
||||
XDebuggerHistoryManager.getInstance(getProject()).addRecentExpression(getRecentsId(), TextWithImportsImpl.toXExpression(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.ui.EditorComboBoxEditor;
|
||||
import com.intellij.ui.EditorComboBoxRenderer;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.impl.XDebuggerHistoryManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -180,10 +181,10 @@ public class DebuggerExpressionComboBox extends DebuggerEditorImpl {
|
||||
final String recentsId = getRecentsId();
|
||||
if (recentsId != null) {
|
||||
final List<TextWithImports> result = new ArrayList<TextWithImports>();
|
||||
List<String> recents = XDebuggerHistoryManager.getInstance(getProject()).getRecentExpressions(getRecentsId());
|
||||
for (String evaluationText : recents) {
|
||||
if (evaluationText.indexOf('\n') == -1) {
|
||||
result.add(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, evaluationText));
|
||||
List<XExpression> recents = XDebuggerHistoryManager.getInstance(getProject()).getRecentExpressions(getRecentsId());
|
||||
for (XExpression expression : recents) {
|
||||
if (expression.getExpression().indexOf('\n') == -1) {
|
||||
result.add(TextWithImportsImpl.fromXExpression(expression));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextListener;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
@@ -29,9 +30,9 @@ import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.RunContentListener;
|
||||
import com.intellij.execution.ui.RunContentManager;
|
||||
@@ -43,49 +44,51 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DebuggerPanelsManager implements ProjectComponent {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerPanelsManager");
|
||||
|
||||
private final Project myProject;
|
||||
private final ExecutionManager myExecutionManager;
|
||||
|
||||
private final PositionHighlighter myEditorManager;
|
||||
private final HashMap<ProcessHandler, DebuggerSessionTab> mySessionTabs = new HashMap<ProcessHandler, DebuggerSessionTab>();
|
||||
//private final PositionHighlighter myEditorManager;
|
||||
//private final HashMap<ProcessHandler, DebuggerSessionTab> mySessionTabs = new HashMap<ProcessHandler, DebuggerSessionTab>();
|
||||
|
||||
public DebuggerPanelsManager(Project project, final EditorColorsManager colorsManager, ExecutionManager executionManager) {
|
||||
myProject = project;
|
||||
myExecutionManager = executionManager;
|
||||
|
||||
myEditorManager = new PositionHighlighter(myProject, getContextManager());
|
||||
|
||||
final EditorColorsListener myColorsListener = new EditorColorsListener() {
|
||||
public void globalSchemeChange(EditorColorsScheme scheme) {
|
||||
myEditorManager.updateContextPointDescription();
|
||||
}
|
||||
};
|
||||
colorsManager.addEditorColorsListener(myColorsListener);
|
||||
Disposer.register(project, new Disposable() {
|
||||
public void dispose() {
|
||||
colorsManager.removeEditorColorsListener(myColorsListener);
|
||||
}
|
||||
});
|
||||
|
||||
getContextManager().addListener(new DebuggerContextListener() {
|
||||
public void changeEvent(final DebuggerContextImpl newContext, int event) {
|
||||
if (event == DebuggerSession.EVENT_PAUSE) {
|
||||
DebuggerInvocationUtil.invokeLater(myProject, new Runnable() {
|
||||
public void run() {
|
||||
toFront(newContext.getDebuggerSession());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
//myEditorManager = new PositionHighlighter(myProject, getContextManager());
|
||||
//
|
||||
//final EditorColorsListener myColorsListener = new EditorColorsListener() {
|
||||
// public void globalSchemeChange(EditorColorsScheme scheme) {
|
||||
// myEditorManager.updateContextPointDescription();
|
||||
// }
|
||||
//};
|
||||
//colorsManager.addEditorColorsListener(myColorsListener);
|
||||
//Disposer.register(project, new Disposable() {
|
||||
// public void dispose() {
|
||||
// colorsManager.removeEditorColorsListener(myColorsListener);
|
||||
// }
|
||||
//});
|
||||
//
|
||||
//getContextManager().addListener(new DebuggerContextListener() {
|
||||
// public void changeEvent(final DebuggerContextImpl newContext, int event) {
|
||||
// if (event == DebuggerSession.EVENT_PAUSE) {
|
||||
// DebuggerInvocationUtil.invokeLater(myProject, new Runnable() {
|
||||
// public void run() {
|
||||
// toFront(newContext.getDebuggerSession());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
}
|
||||
|
||||
private DebuggerStateManager getContextManager() {
|
||||
@@ -129,20 +132,15 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
|
||||
}
|
||||
|
||||
final DebuggerSessionTab sessionTab = new DebuggerSessionTab(myProject, modelEnvironment.getSessionName(), environment, debuggerSession);
|
||||
RunContentDescriptor runContentDescriptor = sessionTab.getRunContentDescriptor();
|
||||
RunContentDescriptor reuseContent = environment.getReuseContent();
|
||||
if (reuseContent != null) {
|
||||
final ProcessHandler prevHandler = reuseContent.getProcessHandler();
|
||||
if (prevHandler != null) {
|
||||
final DebuggerSessionTab prevSession = mySessionTabs.get(prevHandler);
|
||||
if (prevSession != null) {
|
||||
sessionTab.reuse(prevSession);
|
||||
XDebugSession debugSession =
|
||||
XDebuggerManager.getInstance(myProject).startSessionAndShowTab(modelEnvironment.getSessionName(), environment.getReuseContent(), new XDebugProcessStarter() {
|
||||
@Override
|
||||
@NotNull
|
||||
public XDebugProcess start(@NotNull XDebugSession session) {
|
||||
return new JavaDebugProcess(session, debuggerSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
mySessionTabs.put(runContentDescriptor.getProcessHandler(), sessionTab);
|
||||
return runContentDescriptor;
|
||||
});
|
||||
return debugSession.getRunContentDescriptor();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,11 +150,11 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
|
||||
final RunContentListener myContentListener = new RunContentListener() {
|
||||
public void contentSelected(RunContentDescriptor descriptor) {
|
||||
DebuggerSessionTab sessionTab = descriptor != null ? getSessionTab(descriptor.getProcessHandler()) : null;
|
||||
DebuggerSession session = getSession(myProject, descriptor.getExecutionConsole());
|
||||
|
||||
if (sessionTab != null) {
|
||||
if (session != null) {
|
||||
getContextManager()
|
||||
.setState(sessionTab.getContextManager().getContext(), sessionTab.getSession().getState(), DebuggerSession.EVENT_CONTEXT, null);
|
||||
.setState(session.getContextManager().getContext(), session.getState(), DebuggerSession.EVENT_CONTEXT, null);
|
||||
}
|
||||
else {
|
||||
getContextManager()
|
||||
@@ -165,11 +163,6 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
}
|
||||
|
||||
public void contentRemoved(RunContentDescriptor descriptor) {
|
||||
DebuggerSessionTab sessionTab = getSessionTab(descriptor.getProcessHandler());
|
||||
if (sessionTab != null) {
|
||||
mySessionTabs.remove(descriptor.getProcessHandler());
|
||||
Disposer.dispose(sessionTab);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -225,13 +218,21 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private DebuggerSessionTab getSessionTab(ProcessHandler processHandler) {
|
||||
return mySessionTabs.get(processHandler);
|
||||
private DebuggerSession getSession(Project project, ExecutionConsole console) {
|
||||
XDebugSession session = XDebuggerManager.getInstance(project).getDebugSession(console);
|
||||
if (session != null) {
|
||||
XDebugProcess process = session.getDebugProcess();
|
||||
if (process instanceof JavaDebugProcess) {
|
||||
return ((JavaDebugProcess)process).getDebuggerSession();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DebuggerSessionTab getSessionTab(DebuggerSession session) {
|
||||
return session != null ? getSessionTab(session.getProcess().getExecutionResult().getProcessHandler()) : null;
|
||||
//return session != null ? getSessionTab(session.getProcess().getExecutionResult().getProcessHandler()) : null;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ExecutionConsoleEx;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.RunnerLayoutUi;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
@@ -455,32 +456,31 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
myUi.selectAndFocus(myUi.findContent(DebuggerContentInfo.FRAME_CONTENT), true, false);
|
||||
}
|
||||
|
||||
private int myThreadDumpsCount = 0;
|
||||
private int myCurrentThreadDumpId = 1;
|
||||
private static int myThreadDumpsCount = 0;
|
||||
private static int myCurrentThreadDumpId = 1;
|
||||
|
||||
public void addThreadDump(List<ThreadState> threads) {
|
||||
final Project project = getProject();
|
||||
public static void addThreadDump(Project project, List<ThreadState> threads, final RunnerLayoutUi ui, DebuggerSession session) {
|
||||
final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
|
||||
consoleBuilder.filters(ExceptionFilters.getFilters(myDebuggerSession.getSearchScope()));
|
||||
consoleBuilder.filters(ExceptionFilters.getFilters(session.getSearchScope()));
|
||||
final ConsoleView consoleView = consoleBuilder.getConsole();
|
||||
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
|
||||
consoleView.allowHeavyFilters();
|
||||
final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
|
||||
|
||||
final String id = createThreadDumpContentId();
|
||||
final Content content = myUi.createContent(id, panel, id, null, null);
|
||||
final Content content = ui.createContent(id, panel, id, null, null);
|
||||
content.setCloseable(true);
|
||||
content.setDescription("Thread Dump");
|
||||
myUi.addContent(content);
|
||||
myUi.selectAndFocus(content, true, true);
|
||||
ui.addContent(content);
|
||||
ui.selectAndFocus(content, true, true);
|
||||
myThreadDumpsCount += 1;
|
||||
myCurrentThreadDumpId += 1;
|
||||
Disposer.register(this, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
myUi.removeContent(content, true);
|
||||
}
|
||||
});
|
||||
//Disposer.register(this, new Disposable() {
|
||||
// @Override
|
||||
// public void dispose() {
|
||||
// ui.removeContent(content, true);
|
||||
// }
|
||||
//});
|
||||
Disposer.register(content, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
@@ -491,13 +491,13 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
});
|
||||
Disposer.register(content, consoleView);
|
||||
myUi.selectAndFocus(content, true, false);
|
||||
ui.selectAndFocus(content, true, false);
|
||||
if (threads.size() > 0) {
|
||||
panel.selectStackFrame(0);
|
||||
}
|
||||
}
|
||||
|
||||
private String createThreadDumpContentId() {
|
||||
private static String createThreadDumpContentId() {
|
||||
return THREAD_DUMP_CONTENT_PREFIX + " #" + myCurrentThreadDumpId;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBrea
|
||||
@Override
|
||||
public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointClassGroup> groups) {
|
||||
if (b instanceof XBreakpoint) {
|
||||
Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint((XBreakpoint)b);
|
||||
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint((XBreakpoint)b);
|
||||
if (javaBreakpoint == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class XBreakpointGroupingByPackageRule<B> extends XBreakpointGroupingRule
|
||||
public XBreakpointPackageGroup getGroup(@NotNull B breakpoint, @NotNull Collection<XBreakpointPackageGroup> groups) {
|
||||
String packageName = null;
|
||||
if (breakpoint instanceof XBreakpoint) {
|
||||
Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint((XBreakpoint)breakpoint);
|
||||
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint((XBreakpoint)breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
packageName = javaBreakpoint.getPackageName();
|
||||
}
|
||||
|
||||
@@ -42,10 +42,12 @@ import com.intellij.ui.AppUIUtil;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import com.intellij.xdebugger.impl.XDebuggerHistoryManager;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.DefaultLogExpressionComboBoxPanel;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.LocatableEvent;
|
||||
@@ -59,6 +61,8 @@ import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Breakpoint<P extends JavaBreakpointProperties> implements FilteredRequestor, ClassPrepareRequestor {
|
||||
public static Key<Breakpoint> DATA_KEY = Key.create("JavaBreakpoint");
|
||||
|
||||
final XBreakpoint<P> myXBreakpoint;
|
||||
protected final Project myProject;
|
||||
|
||||
@@ -441,10 +445,10 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
try {
|
||||
String logMessage = JDOMExternalizerUtil.readField(parentNode, LOG_MESSAGE_OPTION_NAME);
|
||||
if (logMessage != null && !logMessage.isEmpty()) {
|
||||
TextWithImportsImpl text = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, logMessage);
|
||||
XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultLogExpressionComboBoxPanel.HISTORY_KEY, text.getText());
|
||||
XExpressionImpl expression = XExpressionImpl.fromText(logMessage);
|
||||
XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultLogExpressionComboBoxPanel.HISTORY_KEY, expression);
|
||||
if (Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED"))) {
|
||||
setLogMessage(text);
|
||||
myXBreakpoint.setLogExpressionObject(expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,11 +465,11 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
public abstract PsiElement getEvaluationElement();
|
||||
|
||||
protected TextWithImports getLogMessage() {
|
||||
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, myXBreakpoint.getLogExpression());
|
||||
return TextWithImportsImpl.fromXExpression(myXBreakpoint.getLogExpressionObject());
|
||||
}
|
||||
|
||||
protected TextWithImports getCondition() {
|
||||
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, myXBreakpoint.getCondition());
|
||||
return TextWithImportsImpl.fromXExpression(myXBreakpoint.getConditionExpression());
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
@@ -485,8 +489,8 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
}
|
||||
|
||||
protected boolean isLogExpressionEnabled() {
|
||||
String expression = myXBreakpoint.getLogExpression();
|
||||
if (expression == null || expression.isEmpty()) {
|
||||
XExpression expression = myXBreakpoint.getLogExpressionObject();
|
||||
if (expression == null || expression.getExpression().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return !getLogMessage().isEmpty();
|
||||
@@ -602,30 +606,16 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
myXBreakpoint.setSuspendPolicy(transformSuspendPolicy(policy));
|
||||
}
|
||||
|
||||
protected void setLogMessage(@Nullable TextWithImports logMessage) {
|
||||
if (logMessage != null && !logMessage.getText().isEmpty()) {
|
||||
myXBreakpoint.setLogExpression(logMessage.toExternalForm());
|
||||
}
|
||||
else {
|
||||
myXBreakpoint.setLogExpression(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isConditionEnabled() {
|
||||
String condition = myXBreakpoint.getCondition();
|
||||
if (condition == null || condition.isEmpty()) {
|
||||
XExpression condition = myXBreakpoint.getConditionExpression();
|
||||
if (condition == null || condition.getExpression().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return !getCondition().isEmpty();
|
||||
}
|
||||
|
||||
public void setCondition(@Nullable TextWithImports condition) {
|
||||
if (condition != null && !condition.getText().isEmpty()) {
|
||||
myXBreakpoint.setCondition(condition.toExternalForm());
|
||||
}
|
||||
else {
|
||||
myXBreakpoint.setCondition(null);
|
||||
}
|
||||
myXBreakpoint.setConditionExpression(TextWithImportsImpl.toXExpression(condition));
|
||||
}
|
||||
|
||||
protected void addInstanceFilter(long l) {
|
||||
|
||||
+54
-129
@@ -48,8 +48,8 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.breakpoints.*;
|
||||
@@ -70,7 +70,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaExceptionBreakpointProperties;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BreakpointManager {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.breakpoints.BreakpointManager");
|
||||
@@ -84,12 +87,8 @@ public class BreakpointManager {
|
||||
private static final String CONVERTED_PARAM = "converted";
|
||||
|
||||
private final Project myProject;
|
||||
private final Map<XBreakpoint, Breakpoint> myBreakpoints = new HashMap<XBreakpoint, Breakpoint>(); // breakpoints storage, access should be synchronized
|
||||
@Nullable private List<Breakpoint> myBreakpointsListForIteration = null; // another list for breakpoints iteration, unsynchronized access ok
|
||||
private final Map<String, String> myUIProperties = new LinkedHashMap<String, String>();
|
||||
|
||||
private final EventDispatcher<BreakpointManagerListener> myDispatcher = EventDispatcher.create(BreakpointManagerListener.class);
|
||||
|
||||
private final StartupManager myStartupManager;
|
||||
|
||||
public BreakpointManager(@NotNull Project project, @NotNull StartupManager startupManager, @NotNull DebuggerManagerImpl debuggerManager) {
|
||||
@@ -124,22 +123,18 @@ public class BreakpointManager {
|
||||
|
||||
public void init() {
|
||||
XBreakpointManager manager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
|
||||
manager.addBreakpointListener(new XBreakpointListener() {
|
||||
manager.addBreakpointListener(new XBreakpointAdapter<XBreakpoint<?>>() {
|
||||
@Override
|
||||
public void breakpointAdded(@NotNull XBreakpoint xBreakpoint) {
|
||||
if (isJavaType(xBreakpoint)) {
|
||||
onBreakpointAdded(xBreakpoint);
|
||||
public void breakpointAdded(@NotNull XBreakpoint<?> xBreakpoint) {
|
||||
Breakpoint breakpoint = getJavaBreakpoint(xBreakpoint);
|
||||
if (breakpoint != null) {
|
||||
addBreakpoint(breakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointRemoved(@NotNull XBreakpoint xBreakpoint) {
|
||||
onBreakpointRemoved(xBreakpoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointChanged(@NotNull XBreakpoint xBreakpoint) {
|
||||
Breakpoint breakpoint = myBreakpoints.get(xBreakpoint);
|
||||
Breakpoint breakpoint = getJavaBreakpoint(xBreakpoint);
|
||||
if (breakpoint != null) {
|
||||
fireBreakpointChanged(breakpoint);
|
||||
}
|
||||
@@ -306,13 +301,6 @@ public class BreakpointManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Breakpoint findBreakpoint(@NotNull XBreakpoint xBreakpoint) {
|
||||
Project project = ((XBreakpointBase)xBreakpoint).getProject();
|
||||
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
|
||||
return breakpointManager.myBreakpoints.get(xBreakpoint);
|
||||
}
|
||||
|
||||
private HashMap<String, Element> myOriginalBreakpointsNodes = new HashMap<String, Element>();
|
||||
|
||||
public void readExternal(@NotNull final Element parentNode) {
|
||||
@@ -380,9 +368,11 @@ public class BreakpointManager {
|
||||
XBreakpointManager manager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
|
||||
JavaExceptionBreakpointType type = (JavaExceptionBreakpointType)XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
|
||||
XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint = manager.getDefaultBreakpoint(type);
|
||||
Breakpoint breakpoint = createJavaBreakpoint(xBreakpoint);
|
||||
breakpoint.readExternal(breakpointElement);
|
||||
addBreakpoint(breakpoint);
|
||||
Breakpoint breakpoint = getJavaBreakpoint(xBreakpoint);
|
||||
if (breakpoint != null) {
|
||||
breakpoint.readExternal(breakpointElement);
|
||||
addBreakpoint(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -463,12 +453,12 @@ public class BreakpointManager {
|
||||
xBreakpoint = createXLineBreakpoint(JavaFieldBreakpointType.class, breakpointNode);
|
||||
}
|
||||
else if (category.equals(ExceptionBreakpoint.CATEGORY.toString())) {
|
||||
xBreakpoint = createXBreakpoint(JavaExceptionBreakpointType.class, breakpointNode);
|
||||
xBreakpoint = createXBreakpoint(JavaExceptionBreakpointType.class, breakpointNode);
|
||||
}
|
||||
if (xBreakpoint == null) {
|
||||
throw new IllegalStateException("Unknown breakpoint category " + category);
|
||||
}
|
||||
return myBreakpoints.get(xBreakpoint);
|
||||
return getJavaBreakpoint(xBreakpoint);
|
||||
}
|
||||
|
||||
private <B extends XBreakpoint<?>> XBreakpoint createXBreakpoint(Class<? extends XBreakpointType<B, ?>> typeCls,
|
||||
@@ -477,9 +467,10 @@ public class BreakpointManager {
|
||||
return ApplicationManager.getApplication().runWriteAction(new Computable<XBreakpoint>() {
|
||||
@Override
|
||||
public XBreakpoint compute() {
|
||||
return XDebuggerManager.getInstance(myProject).getBreakpointManager()
|
||||
.addBreakpoint((XBreakpointType)type, type.createProperties());
|
||||
}});
|
||||
return XDebuggerManager.getInstance(myProject).getBreakpointManager()
|
||||
.addBreakpoint((XBreakpointType)type, type.createProperties());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private <B extends XBreakpoint<?>> XLineBreakpoint createXLineBreakpoint(Class<? extends XBreakpointType<B, ?>> typeCls,
|
||||
@@ -505,19 +496,16 @@ public class BreakpointManager {
|
||||
return addXLineBreakpoint(typeCls, doc, line);
|
||||
}
|
||||
|
||||
//used in Fabrique
|
||||
public synchronized void addBreakpoint(@NotNull Breakpoint breakpoint) {
|
||||
myBreakpoints.put(breakpoint.myXBreakpoint, breakpoint);
|
||||
myBreakpointsListForIteration = null;
|
||||
breakpoint.updateUI();
|
||||
RequestManagerImpl.createRequests(breakpoint);
|
||||
myDispatcher.getMulticaster().breakpointsChanged();
|
||||
checkAndNotifyPossiblySlowBreakpoint(breakpoint.myXBreakpoint);
|
||||
public static void addBreakpointInt(@NotNull Breakpoint breakpoint) {
|
||||
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(breakpoint.getProject()).getBreakpointManager();
|
||||
breakpointManager.addBreakpoint(breakpoint);
|
||||
}
|
||||
|
||||
private synchronized void onBreakpointAdded(XBreakpoint xBreakpoint) {
|
||||
Breakpoint breakpoint = createJavaBreakpoint(xBreakpoint);
|
||||
addBreakpoint(breakpoint);
|
||||
//used in Fabrique
|
||||
public void addBreakpoint(@NotNull Breakpoint breakpoint) {
|
||||
breakpoint.myXBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint);
|
||||
breakpoint.updateUI();
|
||||
checkAndNotifyPossiblySlowBreakpoint(breakpoint.myXBreakpoint);
|
||||
}
|
||||
|
||||
public void removeBreakpoint(@Nullable final Breakpoint breakpoint) {
|
||||
@@ -532,24 +520,6 @@ public class BreakpointManager {
|
||||
});
|
||||
}
|
||||
|
||||
private synchronized void onBreakpointRemoved(@Nullable final XBreakpoint xBreakpoint) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (xBreakpoint == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Breakpoint breakpoint = myBreakpoints.remove(xBreakpoint);
|
||||
if (breakpoint != null) {
|
||||
//updateBreakpointRules(breakpoint);
|
||||
myBreakpointsListForIteration = null;
|
||||
//we delete breakpoints inside release, so gutter will not fire events to deleted breakpoints
|
||||
breakpoint.delete();
|
||||
|
||||
RequestManagerImpl.deleteRequests(breakpoint);
|
||||
myDispatcher.getMulticaster().breakpointsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void writeExternal(@NotNull final Element parentNode) {
|
||||
// restore old breakpoints
|
||||
for (Element group : myOriginalBreakpointsNodes.values()) {
|
||||
@@ -563,39 +533,34 @@ public class BreakpointManager {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public synchronized List<Breakpoint> getBreakpoints() {
|
||||
if (myBreakpointsListForIteration == null) {
|
||||
myBreakpointsListForIteration = new ArrayList<Breakpoint>(myBreakpoints.size());
|
||||
|
||||
XBreakpoint<?>[] xBreakpoints = ApplicationManager.getApplication().runReadAction(new Computable<XBreakpoint<?>[]>() {
|
||||
public XBreakpoint<?>[] compute() {
|
||||
return getXBreakpointManager().getAllBreakpoints();
|
||||
}
|
||||
});
|
||||
for (XBreakpoint<?> xBreakpoint : xBreakpoints) {
|
||||
if (isJavaType(xBreakpoint)) {
|
||||
Breakpoint breakpoint = myBreakpoints.get(xBreakpoint);
|
||||
if (breakpoint == null) {
|
||||
breakpoint = createJavaBreakpoint(xBreakpoint);
|
||||
myBreakpoints.put(xBreakpoint, breakpoint);
|
||||
public List<Breakpoint> getBreakpoints() {
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<List<Breakpoint>>() {
|
||||
@Override
|
||||
public List<Breakpoint> compute() {
|
||||
return ContainerUtil.mapNotNull(getXBreakpointManager().getAllBreakpoints(), new Function<XBreakpoint<?>, Breakpoint>() {
|
||||
@Override
|
||||
public Breakpoint fun(XBreakpoint<?> xBreakpoint) {
|
||||
return getJavaBreakpoint(xBreakpoint);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
myBreakpointsListForIteration.addAll(myBreakpoints.values());
|
||||
@Nullable
|
||||
public static Breakpoint getJavaBreakpoint(@Nullable XBreakpoint xBreakpoint) {
|
||||
if (xBreakpoint == null) {
|
||||
return null;
|
||||
}
|
||||
return myBreakpointsListForIteration;
|
||||
}
|
||||
|
||||
private boolean isJavaType(XBreakpoint xBreakpoint) {
|
||||
return xBreakpoint.getType() instanceof JavaBreakpointType;
|
||||
}
|
||||
|
||||
private Breakpoint createJavaBreakpoint(XBreakpoint xBreakpoint) {
|
||||
Breakpoint breakpoint = xBreakpoint.getUserData(Breakpoint.DATA_KEY);
|
||||
if (breakpoint != null) {
|
||||
return breakpoint;
|
||||
}
|
||||
Project project = ((XBreakpointBase)xBreakpoint).getProject();
|
||||
if (xBreakpoint.getType() instanceof JavaBreakpointType) {
|
||||
return ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(myProject, xBreakpoint);
|
||||
return ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint);
|
||||
}
|
||||
throw new IllegalStateException("Unsupported breakpoint type:" + xBreakpoint.getType());
|
||||
return null;
|
||||
}
|
||||
|
||||
//interaction with RequestManagerImpl
|
||||
@@ -698,15 +663,6 @@ public class BreakpointManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAllRequests() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
List<Breakpoint> breakpoints = getBreakpoints();
|
||||
for (Breakpoint breakpoint : breakpoints) {
|
||||
fireBreakpointChanged(breakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateBreakpointsUI() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
for (Breakpoint breakpoint : getBreakpoints()) {
|
||||
@@ -722,41 +678,10 @@ public class BreakpointManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void addBreakpointManagerListener(@NotNull BreakpointManagerListener listener) {
|
||||
myDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeBreakpointManagerListener(@NotNull BreakpointManagerListener listener) {
|
||||
myDispatcher.removeListener(listener);
|
||||
}
|
||||
|
||||
private boolean myAllowMulticasting = true;
|
||||
private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
|
||||
public void fireBreakpointChanged(Breakpoint breakpoint) {
|
||||
breakpoint.reload();
|
||||
breakpoint.updateUI();
|
||||
RequestManagerImpl.updateRequests(breakpoint);
|
||||
if (myAllowMulticasting) {
|
||||
// can be invoked from non-AWT thread
|
||||
myAlarm.cancelAllRequests();
|
||||
final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myDispatcher.getMulticaster().breakpointsChanged();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
if (ApplicationManager.getApplication().isDispatchThread()) {
|
||||
runnable.run();
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(runnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBreakpointEnabled(@NotNull final Breakpoint breakpoint, final boolean enabled) {
|
||||
@@ -796,7 +721,7 @@ public class BreakpointManager {
|
||||
@Nullable
|
||||
public Breakpoint findMasterBreakpoint(@NotNull Breakpoint dependentBreakpoint) {
|
||||
XDependentBreakpointManager dependentBreakpointManager = ((XBreakpointManagerImpl)getXBreakpointManager()).getDependentBreakpointManager();
|
||||
return myBreakpoints.get(dependentBreakpointManager.getMasterBreakpoint(dependentBreakpoint.myXBreakpoint));
|
||||
return getJavaBreakpoint(dependentBreakpointManager.getMasterBreakpoint(dependentBreakpoint.myXBreakpoint));
|
||||
}
|
||||
|
||||
public String getProperty(String name) {
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
@@ -121,7 +122,7 @@ public class ExceptionBreakpoint extends Breakpoint<JavaExceptionBreakpointPrope
|
||||
return;
|
||||
}
|
||||
|
||||
SourcePosition classPosition = PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Computable<SourcePosition>() {
|
||||
SourcePosition classPosition = ApplicationManager.getApplication().runReadAction(new Computable<SourcePosition>() {
|
||||
public SourcePosition compute() {
|
||||
PsiClass psiClass = DebuggerUtils.findClass(getQualifiedName(), myProject, debugProcess.getSearchScope());
|
||||
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ public class FilteredRequestorImpl implements JDOMExternalizable, FilteredReques
|
||||
|
||||
breakpoint.setCondition(CONDITION_ENABLED ? myCondition : null);
|
||||
if (myCondition != null && !myCondition.isEmpty()) {
|
||||
XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultConditionComboBoxPanel.HISTORY_KEY, myCondition.getText());
|
||||
XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultConditionComboBoxPanel.HISTORY_KEY, TextWithImportsImpl.toXExpression(myCondition));
|
||||
}
|
||||
|
||||
breakpoint.setClassFiltersEnabled(CLASS_FILTERS_ENABLED);
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
|
||||
|
||||
/**
|
||||
@@ -24,5 +25,6 @@ import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperti
|
||||
* @author egor
|
||||
*/
|
||||
public interface JavaBreakpointType<P extends JavaBreakpointProperties> {
|
||||
@NotNull
|
||||
Breakpoint createJavaBreakpoint(Project project, XBreakpoint<P> breakpoint);
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public abstract class JavaBreakpointTypeBase<T extends JavaBreakpointProperties>
|
||||
@Nullable
|
||||
@Override
|
||||
public XSourcePosition getSourcePosition(@NotNull XBreakpoint<T> breakpoint) {
|
||||
Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint(breakpoint);
|
||||
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
PsiClass aClass = javaBreakpoint.getPsiClass();
|
||||
if (aClass != null && aClass.getContainingFile() != null) {
|
||||
|
||||
+1
@@ -126,6 +126,7 @@ public class JavaExceptionBreakpointType extends JavaBreakpointTypeBase<JavaExce
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Breakpoint createJavaBreakpoint(Project project, XBreakpoint<JavaExceptionBreakpointProperties> breakpoint) {
|
||||
if (!XDebuggerManager.getInstance(project).getBreakpointManager().isDefaultBreakpoint(breakpoint)) {
|
||||
|
||||
+1
@@ -164,6 +164,7 @@ public class JavaFieldBreakpointType extends JavaLineBreakpointTypeBase<JavaFiel
|
||||
return result.get();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Breakpoint createJavaBreakpoint(Project project, XBreakpoint breakpoint) {
|
||||
return new FieldBreakpoint(project, breakpoint);
|
||||
|
||||
+1
@@ -80,6 +80,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
|
||||
return new JavaLineBreakpointProperties();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Breakpoint createJavaBreakpoint(Project project, XBreakpoint breakpoint) {
|
||||
return new LineBreakpoint(project, breakpoint);
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public abstract class JavaLineBreakpointTypeBase<P extends JavaBreakpointPropert
|
||||
|
||||
@Override
|
||||
public String getDisplayText(XLineBreakpoint<P> breakpoint) {
|
||||
BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)BreakpointManager.findBreakpoint(breakpoint);
|
||||
BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)BreakpointManager.getJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
return javaBreakpoint.getDescription();
|
||||
}
|
||||
|
||||
+1
@@ -110,6 +110,7 @@ public class JavaMethodBreakpointType extends JavaLineBreakpointTypeBase<JavaMet
|
||||
return new JavaMethodBreakpointProperties();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Breakpoint createJavaBreakpoint(Project project, XBreakpoint breakpoint) {
|
||||
return new MethodBreakpoint(project, breakpoint);
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ public class JavaWildcardMethodBreakpointType extends JavaBreakpointTypeBase<Jav
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Breakpoint createJavaBreakpoint(Project project, XBreakpoint breakpoint) {
|
||||
return new WildcardMethodBreakpoint(project, breakpoint);
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.debugger.engine.requests.RequestManagerImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
@@ -310,7 +311,9 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
return null;
|
||||
}
|
||||
//final int endOffset = document.getLineEndOffset(sourcePosition);
|
||||
final MethodDescriptor descriptor = docManager.commitAndRunReadAction(new Computable<MethodDescriptor>() {
|
||||
//final MethodDescriptor descriptor = docManager.commitAndRunReadAction(new Computable<MethodDescriptor>() {
|
||||
// conflicts with readAction on initial breakpoints creation
|
||||
final MethodDescriptor descriptor = ApplicationManager.getApplication().runReadAction(new Computable<MethodDescriptor>() {
|
||||
@Nullable
|
||||
public MethodDescriptor compute() {
|
||||
//PsiMethod method = DebuggerUtilsEx.findPsiMethod(psiJavaFile, endOffset);
|
||||
|
||||
@@ -37,7 +37,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements DataProvider {
|
||||
public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements DataProvider, Disposable {
|
||||
public static final DataKey<DebuggerTreePanel> DATA_KEY = DataKey.create("DebuggerPanel");
|
||||
|
||||
private final SingleAlarm myRebuildAlarm = new SingleAlarm(new Runnable() {
|
||||
|
||||
@@ -162,7 +162,7 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
super.buildVariables(stackDescriptor, evaluationContext);
|
||||
}
|
||||
else {
|
||||
final Map<String, LocalVariableProxyImpl> visibleVariables = getVisibleVariables(stackDescriptor);
|
||||
final Map<String, LocalVariableProxyImpl> visibleVariables = getVisibleVariables(stackDescriptor.getFrameProxy());
|
||||
final EvaluationContextImpl evalContext = debuggerContext.createEvaluationContext();
|
||||
final Pair<Set<String>, Set<TextWithImports>> usedVars =
|
||||
ApplicationManager.getApplication().runReadAction(new Computable<Pair<Set<String>, Set<TextWithImports>>>() {
|
||||
@@ -225,7 +225,7 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<DecompiledLocalVariable> collectVariablesFromBytecode(final StackFrameProxy frame, int argumentCount) throws EvaluateException {
|
||||
public static List<DecompiledLocalVariable> collectVariablesFromBytecode(final StackFrameProxy frame, int argumentCount) throws EvaluateException {
|
||||
if (!frame.getVirtualMachine().canGetBytecodes()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -276,8 +276,7 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static Map<String, LocalVariableProxyImpl> getVisibleVariables(final StackFrameDescriptorImpl stackDescriptor) throws EvaluateException {
|
||||
final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy();
|
||||
public static Map<String, LocalVariableProxyImpl> getVisibleVariables(final StackFrameProxyImpl frame) throws EvaluateException {
|
||||
final Map<String, LocalVariableProxyImpl> vars = new HashMap<String, LocalVariableProxyImpl>();
|
||||
for (LocalVariableProxyImpl localVariableProxy : frame.visibleVariables()) {
|
||||
vars.put(localVariableProxy.name(), localVariableProxy);
|
||||
@@ -318,7 +317,7 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Pair<Set<String>, Set<TextWithImports>> findReferencedVars(final Set<String> visibleVars,
|
||||
public static Pair<Set<String>, Set<TextWithImports>> findReferencedVars(final Set<String> visibleVars,
|
||||
final SourcePosition position,
|
||||
EvaluationContextImpl evalContext) {
|
||||
final int line = position.getLine();
|
||||
|
||||
@@ -404,7 +404,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
public abstract class BuildNodeCommand extends DebuggerContextCommandImpl {
|
||||
private final DebuggerTreeNodeImpl myNode;
|
||||
|
||||
protected final List<DebuggerTreeNode> myChildren = new LinkedList<DebuggerTreeNode>();
|
||||
protected final List<DebuggerTreeNodeImpl> myChildren = new LinkedList<DebuggerTreeNodeImpl>();
|
||||
|
||||
protected BuildNodeCommand(DebuggerTreeNodeImpl node) {
|
||||
super(DebuggerTree.this.getDebuggerContext());
|
||||
@@ -425,7 +425,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
@Override
|
||||
public void run() {
|
||||
myNode.removeAllChildren();
|
||||
for (DebuggerTreeNode debuggerTreeNode : myChildren) {
|
||||
for (DebuggerTreeNodeImpl debuggerTreeNode : myChildren) {
|
||||
myNode.add(debuggerTreeNode);
|
||||
}
|
||||
myNode.childrenChanged(scrollToVisible);
|
||||
@@ -587,9 +587,16 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
return (ValueDescriptorImpl)getNode().getDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemaining(int remaining) {}
|
||||
|
||||
@Override
|
||||
public void setChildren(final List<DebuggerTreeNode> children) {
|
||||
myChildren.addAll(children);
|
||||
for (DebuggerTreeNode child : children) {
|
||||
if (child instanceof DebuggerTreeNodeImpl) {
|
||||
myChildren.add(((DebuggerTreeNodeImpl)child));
|
||||
}
|
||||
}
|
||||
updateUI(false);
|
||||
}
|
||||
}
|
||||
@@ -661,7 +668,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
|
||||
private class BuildThreadGroupCommand extends DebuggerCommandImpl {
|
||||
private final DebuggerTreeNodeImpl myNode;
|
||||
protected final List<DebuggerTreeNode> myChildren = new LinkedList<DebuggerTreeNode>();
|
||||
protected final List<DebuggerTreeNodeImpl> myChildren = new LinkedList<DebuggerTreeNodeImpl>();
|
||||
|
||||
public BuildThreadGroupCommand(DebuggerTreeNodeImpl node) {
|
||||
myNode = node;
|
||||
@@ -719,7 +726,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
@Override
|
||||
public void run() {
|
||||
myNode.removeAllChildren();
|
||||
for (DebuggerTreeNode debuggerTreeNode : myChildren) {
|
||||
for (DebuggerTreeNodeImpl debuggerTreeNode : myChildren) {
|
||||
myNode.add(debuggerTreeNode);
|
||||
}
|
||||
myNode.childrenChanged(scrollToVisible);
|
||||
|
||||
+2
-1
@@ -258,7 +258,8 @@ public class DebuggerTreeNodeExpression {
|
||||
|
||||
public static PsiExpression getEvaluationExpression(DebuggerTreeNodeImpl node, DebuggerContextImpl context) throws EvaluateException {
|
||||
if(node.getDescriptor() instanceof ValueDescriptorImpl) {
|
||||
return ((ValueDescriptorImpl)node.getDescriptor()).getTreeEvaluation(node, context);
|
||||
throw new IllegalStateException("Not supported any more");
|
||||
//return ((ValueDescriptorImpl)node.getDescriptor()).getTreeEvaluation(node, context);
|
||||
}
|
||||
else {
|
||||
LOG.error(node.getDescriptor() != null ? node.getDescriptor().getClass().getName() : "null");
|
||||
|
||||
+3
-2
@@ -40,16 +40,17 @@ import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.MutableTreeNode;
|
||||
import java.util.Map;
|
||||
|
||||
public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTreeNode{
|
||||
public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTreeNode, NodeDescriptorProvider, MutableTreeNode {
|
||||
private Icon myIcon;
|
||||
private SimpleColoredText myText;
|
||||
private String myMarkupTooltipText;
|
||||
private final DebuggerTree myTree;
|
||||
private final Map myProperties = new HashMap();
|
||||
|
||||
private DebuggerTreeNodeImpl(DebuggerTree tree, NodeDescriptor descriptor) {
|
||||
public DebuggerTreeNodeImpl(DebuggerTree tree, NodeDescriptor descriptor) {
|
||||
super(descriptor);
|
||||
myTree = tree;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.sun.jdi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -70,6 +71,7 @@ public class FieldDescriptorImpl extends ValueDescriptorImpl implements FieldDes
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
@Nullable
|
||||
public SourcePosition getSourcePosition(final Project project, final DebuggerContextImpl context) {
|
||||
if (context.getFrameProxy() == null) {
|
||||
return null;
|
||||
|
||||
+2
@@ -35,6 +35,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements LocalVariableDescriptor {
|
||||
private final StackFrameProxyImpl myFrameProxy;
|
||||
@@ -58,6 +59,7 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements
|
||||
return myLocalVariable;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SourcePosition getSourcePosition(final Project project, final DebuggerContextImpl context) {
|
||||
StackFrameProxyImpl frame = context.getFrameProxy();
|
||||
if (frame == null) return null;
|
||||
|
||||
+9
-9
@@ -58,7 +58,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory {
|
||||
myDisplayDescriptorSearcher.clear();
|
||||
}
|
||||
|
||||
private <T extends NodeDescriptor> T getDescriptor(NodeDescriptor parent, DescriptorData<T> key) {
|
||||
public <T extends NodeDescriptor> T getDescriptor(NodeDescriptor parent, DescriptorData<T> key) {
|
||||
final T descriptor = key.createDescriptor(myProject);
|
||||
|
||||
final T oldDescriptor = findDescriptor(parent, descriptor, key);
|
||||
@@ -199,23 +199,23 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory {
|
||||
}
|
||||
|
||||
private static class DescriptorTreeSearcher {
|
||||
private final MarkedDescriptorTree myDescriportTree;
|
||||
private final MarkedDescriptorTree myDescriptorTree;
|
||||
|
||||
private final HashMap<NodeDescriptor, NodeDescriptor> mySearchedDescriptors = new HashMap<NodeDescriptor, NodeDescriptor>();
|
||||
|
||||
public DescriptorTreeSearcher(MarkedDescriptorTree descriportTree) {
|
||||
myDescriportTree = descriportTree;
|
||||
public DescriptorTreeSearcher(MarkedDescriptorTree descriptorTree) {
|
||||
myDescriptorTree = descriptorTree;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public <T extends NodeDescriptor> T search(NodeDescriptor parent, T descriptor, DescriptorKey<T> key) {
|
||||
final T result;
|
||||
if(parent == null) {
|
||||
result = myDescriportTree.getChild(null, key);
|
||||
result = myDescriptorTree.getChild(null, key);
|
||||
}
|
||||
else {
|
||||
final NodeDescriptor parentDescriptor = getSearched(parent);
|
||||
result = parentDescriptor != null ? myDescriportTree.getChild(parentDescriptor, key) : null;
|
||||
result = parentDescriptor != null ? myDescriptorTree.getChild(parentDescriptor, key) : null;
|
||||
}
|
||||
if(result != null) {
|
||||
mySearchedDescriptors.put(descriptor, result);
|
||||
@@ -229,13 +229,13 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory {
|
||||
|
||||
public void clear() {
|
||||
mySearchedDescriptors.clear();
|
||||
myDescriportTree.clear();
|
||||
myDescriptorTree.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private class DisplayDescriptorTreeSearcher extends DescriptorTreeSearcher {
|
||||
public DisplayDescriptorTreeSearcher(MarkedDescriptorTree descriportTree) {
|
||||
super(descriportTree);
|
||||
public DisplayDescriptorTreeSearcher(MarkedDescriptorTree descriptorTree) {
|
||||
super(descriptorTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -13,10 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
package com.intellij.debugger.ui.impl.watch;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
public interface BreakpointManagerListener extends EventListener{
|
||||
void breakpointsChanged ();
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public interface NodeDescriptorProvider {
|
||||
NodeDescriptorImpl getDescriptor();
|
||||
}
|
||||
+34
-9
@@ -17,16 +17,14 @@ package com.intellij.debugger.ui.impl.watch;
|
||||
|
||||
import com.intellij.Patches;
|
||||
import com.intellij.debugger.DebuggerContext;
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.tree.DebuggerTreeNode;
|
||||
import com.intellij.debugger.ui.tree.NodeDescriptor;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.*;
|
||||
@@ -364,18 +362,18 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
|
||||
}
|
||||
|
||||
//returns expression that evaluates tree to this descriptor
|
||||
public PsiExpression getTreeEvaluation(DebuggerTreeNodeImpl debuggerTreeNode, DebuggerContextImpl context) throws EvaluateException {
|
||||
if(debuggerTreeNode.getParent() != null && debuggerTreeNode.getParent().getDescriptor() instanceof ValueDescriptor) {
|
||||
final NodeDescriptorImpl descriptor = debuggerTreeNode.getParent().getDescriptor();
|
||||
public PsiExpression getTreeEvaluation(JavaValue value, DebuggerContextImpl context) throws EvaluateException {
|
||||
if(value.getParent() != null) {
|
||||
final NodeDescriptorImpl descriptor = value.getParent().getDescriptor();
|
||||
final ValueDescriptorImpl vDescriptor = ((ValueDescriptorImpl)descriptor);
|
||||
final PsiExpression parentEvaluation = vDescriptor.getTreeEvaluation(debuggerTreeNode.getParent(), context);
|
||||
final PsiExpression parentEvaluation = vDescriptor.getTreeEvaluation(value.getParent(), context);
|
||||
|
||||
if (parentEvaluation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return DebuggerTreeNodeExpression.substituteThis(
|
||||
vDescriptor.getRenderer(context.getDebugProcess()).getChildValueExpression(debuggerTreeNode, context),
|
||||
vDescriptor.getRenderer(context.getDebugProcess()).getChildValueExpression(new DebuggerTreeNodeMock(value), context),
|
||||
parentEvaluation, vDescriptor.getValue()
|
||||
);
|
||||
}
|
||||
@@ -383,6 +381,33 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
|
||||
return getDescriptorEvaluation(context);
|
||||
}
|
||||
|
||||
private static class DebuggerTreeNodeMock implements DebuggerTreeNode {
|
||||
private final JavaValue value;
|
||||
|
||||
public DebuggerTreeNodeMock(JavaValue value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebuggerTreeNode getParent() {
|
||||
return new DebuggerTreeNodeMock(value.getParent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueDescriptorImpl getDescriptor() {
|
||||
return value.getDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return value.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderer(NodeRenderer renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
//returns expression that evaluates descriptor value
|
||||
//use 'this' to reference parent node
|
||||
//for ex. FieldDescriptorImpl should return
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.debugger.ui.tree.render.NodeRenderer;
|
||||
|
||||
import javax.swing.tree.MutableTreeNode;
|
||||
|
||||
public interface DebuggerTreeNode extends MutableTreeNode{
|
||||
public interface DebuggerTreeNode {
|
||||
DebuggerTreeNode getParent();
|
||||
|
||||
NodeDescriptor getDescriptor();
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.SuspendContext;
|
||||
import com.intellij.debugger.engine.managerThread.SuspendContextCommand;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.tree.DebuggerTreeNode;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.NodeRenderer;
|
||||
@@ -65,7 +66,7 @@ public class ShowAllAs extends AnAction {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DebuggerTreeNode selectedNode = ((DebuggerUtilsEx)DebuggerUtils.getInstance()).getSelectedNode(e.getDataContext());
|
||||
DebuggerTreeNodeImpl selectedNode = (DebuggerTreeNodeImpl)((DebuggerUtilsEx)DebuggerUtils.getInstance()).getSelectedNode(e.getDataContext());
|
||||
if(selectedNode == null) return;
|
||||
|
||||
if(!isPrimitiveArray(selectedNode)) return;
|
||||
|
||||
@@ -123,6 +123,7 @@ public class ArrayRenderer extends NodeRendererImpl{
|
||||
for (idx = start; idx <= end; idx++) {
|
||||
DebuggerTreeNode arrayItemNode = nodeManager.createNode(descriptorFactory.getArrayItemDescriptor(builder.getParentDescriptor(), array, idx), evaluationContext);
|
||||
|
||||
if (arrayItemNode == null) continue;
|
||||
if (ViewsGeneralSettings.getInstance().HIDE_NULL_ARRAY_ELEMENTS && ((ValueDescriptorImpl)arrayItemNode.getDescriptor()).isNull()) continue;
|
||||
if(added >= (ENTRIES_LIMIT + 1)/ 2) break;
|
||||
children.add(arrayItemNode);
|
||||
@@ -135,6 +136,7 @@ public class ArrayRenderer extends NodeRendererImpl{
|
||||
for (idx = end; idx >= start; idx--) {
|
||||
DebuggerTreeNode arrayItemNode = nodeManager.createNode(descriptorFactory.getArrayItemDescriptor(builder.getParentDescriptor(), array, idx), evaluationContext);
|
||||
|
||||
if (arrayItemNode == null) continue;
|
||||
if (ViewsGeneralSettings.getInstance().HIDE_NULL_ARRAY_ELEMENTS && ((ValueDescriptorImpl)arrayItemNode.getDescriptor()).isNull()) continue;
|
||||
if(added >= ENTRIES_LIMIT) break;
|
||||
childrenTail.add(arrayItemNode);
|
||||
@@ -168,12 +170,13 @@ public class ArrayRenderer extends NodeRendererImpl{
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(START_INDEX > 0) {
|
||||
children.add(0, nodeManager.createMessageNode(new MessageDescriptor(MORE_ELEMENTS, MessageDescriptor.SPECIAL)));
|
||||
}
|
||||
//if(START_INDEX > 0) {
|
||||
// children.add(0, nodeManager.createMessageNode(new MessageDescriptor(MORE_ELEMENTS, MessageDescriptor.SPECIAL)));
|
||||
//}
|
||||
|
||||
if(END_INDEX < array.length() - 1) {
|
||||
children.add(nodeManager.createMessageNode(new MessageDescriptor(MORE_ELEMENTS, MessageDescriptor.SPECIAL)));
|
||||
//children.add(nodeManager.createMessageNode(new MessageDescriptor(MORE_ELEMENTS, MessageDescriptor.SPECIAL)));
|
||||
builder.setRemaining(array.length()-END_INDEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface ChildrenBuilder {
|
||||
ValueDescriptor getParentDescriptor();
|
||||
|
||||
void setChildren(List<DebuggerTreeNode> children);
|
||||
|
||||
void setRemaining(int remaining);
|
||||
}
|
||||
|
||||
+58
-75
@@ -1,28 +1,31 @@
|
||||
package org.jetbrains.java.debugger;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.ui.DebuggerExpressionComboBox;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.DebuggerEditorImpl;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.JavaCodeFragmentFactory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.evaluation.EvaluationMode;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProviderBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.XDebuggerComboBoxProvider;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class JavaDebuggerEditorsProvider extends XDebuggerEditorsProviderBase implements XDebuggerComboBoxProvider {
|
||||
public class JavaDebuggerEditorsProvider extends XDebuggerEditorsProviderBase {
|
||||
@NotNull
|
||||
@Override
|
||||
public FileType getFileType() {
|
||||
@@ -30,80 +33,60 @@ public class JavaDebuggerEditorsProvider extends XDebuggerEditorsProviderBase im
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiFile createExpressionCodeFragment(@NotNull Project project, @NotNull String text, @Nullable PsiElement context, boolean isPhysical) {
|
||||
protected PsiFile createExpressionCodeFragment(@NotNull Project project,
|
||||
@NotNull String text,
|
||||
@Nullable PsiElement context,
|
||||
boolean isPhysical) {
|
||||
return JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment(text, context, null, isPhysical);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XBreakpointCustomPropertiesPanel<XBreakpoint<?>> createConditionComboBoxPanel(Project project,
|
||||
XDebuggerEditorsProvider debuggerEditorsProvider,
|
||||
String historyId,
|
||||
XSourcePosition sourcePosition) {
|
||||
return new ExpressionComboBoxPanel(project, historyId, sourcePosition) {
|
||||
@Override
|
||||
public void saveTo(@NotNull XBreakpoint<?> breakpoint) {
|
||||
TextWithImports text = myComboBox.getText();
|
||||
final String condition = !text.getText().isEmpty() ? text.toExternalForm() : null;
|
||||
breakpoint.setCondition(condition);
|
||||
if (condition != null) {
|
||||
myComboBox.addRecent(text);
|
||||
}
|
||||
public Collection<Language> getSupportedLanguages(@NotNull Project project, @Nullable XSourcePosition sourcePosition) {
|
||||
if (sourcePosition != null) {
|
||||
PsiElement context = getContextElement(sourcePosition.getFile(), sourcePosition.getOffset(), project);
|
||||
Collection<Language> res = new ArrayList<Language>();
|
||||
for (CodeFragmentFactory factory : DebuggerUtilsEx.getCodeFragmentFactories(context)) {
|
||||
res.add(factory.getFileType().getLanguage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFrom(@NotNull XBreakpoint<?> breakpoint) {
|
||||
myComboBox.setText(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, StringUtil.notNullize(breakpoint.getCondition())));
|
||||
}
|
||||
};
|
||||
@NotNull
|
||||
@Override
|
||||
public XExpression createExpression(@NotNull Project project, @NotNull Document document, @Nullable Language language, @NotNull EvaluationMode mode) {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile != null) {
|
||||
return new XExpressionImpl(psiFile.getText(), language, ((JavaCodeFragment)psiFile).importsToString(), mode);
|
||||
}
|
||||
return super.createExpression(project, document, language, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XBreakpointCustomPropertiesPanel<XBreakpoint<?>> createLogExpressionComboBoxPanel(Project project,
|
||||
XDebuggerEditorsProvider debuggerEditorsProvider,
|
||||
String historyId,
|
||||
XSourcePosition sourcePosition) {
|
||||
return new ExpressionComboBoxPanel(project, historyId, sourcePosition) {
|
||||
@Override
|
||||
public void saveTo(@NotNull XBreakpoint<?> breakpoint) {
|
||||
TextWithImports text = myComboBox.getText();
|
||||
breakpoint.setLogExpression(myComboBox.isEnabled() && !text.getText().isEmpty() ? text.toExternalForm() : null);
|
||||
if (text != null) {
|
||||
myComboBox.addRecent(text);
|
||||
protected PsiFile createExpressionCodeFragment(@NotNull Project project,
|
||||
@NotNull XExpression expression,
|
||||
@Nullable PsiElement context,
|
||||
boolean isPhysical) {
|
||||
TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
|
||||
if (text != null && context != null) {
|
||||
CodeFragmentFactory factory = DebuggerEditorImpl.findAppropriateFactory(text, context);
|
||||
JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
|
||||
codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
|
||||
if (context != null) {
|
||||
final PsiClass contextClass = PsiTreeUtil.getNonStrictParentOfType(context, PsiClass.class);
|
||||
if (contextClass != null) {
|
||||
final PsiClassType contextType =
|
||||
JavaPsiFacade.getInstance(codeFragment.getProject()).getElementFactory().createType(contextClass);
|
||||
codeFragment.setThisType(contextType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFrom(@NotNull XBreakpoint<?> breakpoint) {
|
||||
myComboBox.setText(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, StringUtil.notNullize(breakpoint.getLogExpression())));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private abstract class ExpressionComboBoxPanel extends XBreakpointCustomPropertiesPanel<XBreakpoint<?>> {
|
||||
protected final DebuggerExpressionComboBox myComboBox;
|
||||
|
||||
private ExpressionComboBoxPanel(Project project,
|
||||
String historyId,
|
||||
XSourcePosition sourcePosition) {
|
||||
myComboBox = new DebuggerExpressionComboBox(project, historyId);
|
||||
if (sourcePosition != null) {
|
||||
PsiElement element = getContextElement(sourcePosition.getFile(), sourcePosition.getOffset(), project);
|
||||
myComboBox.setContext(element);
|
||||
}
|
||||
else {
|
||||
myComboBox.setContext(null);
|
||||
}
|
||||
return codeFragment;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return myComboBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
myComboBox.dispose();
|
||||
else {
|
||||
return super.createExpressionCodeFragment(project, expression, context, isPhysical);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
package org.jetbrains.java.debugger.breakpoints;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.LineBreakpoint;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class JavaBreakpointAdapterBase extends XBreakpointAdapter<XLineBreakpoint<XBreakpointProperties>> {
|
||||
protected final Project myProject;
|
||||
|
||||
public JavaBreakpointAdapterBase(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LineBreakpoint createBreakpoint(XLineBreakpoint<XBreakpointProperties> breakpoint) {
|
||||
String url = breakpoint.getFileUrl();
|
||||
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
Document document = file != null ? FileDocumentManager.getInstance().getDocument(file) : null;
|
||||
if (document == null) {
|
||||
return null;
|
||||
}
|
||||
LineBreakpoint jBreakpoint = createInvisibleBreakpoint(myProject, document, breakpoint);
|
||||
configureCreatedBreakpoint(jBreakpoint, breakpoint);
|
||||
return jBreakpoint;
|
||||
}
|
||||
|
||||
protected void configureCreatedBreakpoint(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void breakpointChanged(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint) {
|
||||
LineBreakpoint jBreakpoint = findBreakpoint(breakpoint);
|
||||
if (jBreakpoint != null) {
|
||||
updateBreakpoint(jBreakpoint, breakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void updateBreakpoint(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint);
|
||||
|
||||
protected abstract LineBreakpoint findBreakpoint(XLineBreakpoint<XBreakpointProperties> breakpoint);
|
||||
|
||||
protected LineBreakpoint createInvisibleBreakpoint(Project project, Document document, XLineBreakpoint<XBreakpointProperties> breakpoint) {
|
||||
LineBreakpoint oldBreakpoint = doCreateInstance(project, document, breakpoint);
|
||||
oldBreakpoint.setVisible(false);
|
||||
oldBreakpoint.updateUI();
|
||||
oldBreakpoint.setEnabled(breakpoint.isEnabled());
|
||||
return oldBreakpoint;
|
||||
}
|
||||
|
||||
protected LineBreakpoint doCreateInstance(Project project, Document document, XLineBreakpoint<XBreakpointProperties> xBreakpoint) {
|
||||
return LineBreakpoint.create(project, xBreakpoint);
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
|
||||
private static boolean isRootInExistingFile(VirtualFile root) {
|
||||
if (root.getFileSystem() instanceof JarFileSystem) {
|
||||
VirtualFile jar = JarFileSystem.getInstance().getVirtualFileForJar(root);
|
||||
// we might be invoked outside EDT, so sync VFS refresh is impossible, so we check java.io.File existence
|
||||
if (jar == null || !VfsUtilCore.virtualToIoFile(jar).exists()) return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class CreateFromUsageUtils {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IncorrectOperationException("Failed to parse file template",e);
|
||||
throw new IncorrectOperationException("Failed to parse file template", (Throwable)e);
|
||||
}
|
||||
|
||||
if (methodText != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -382,8 +382,9 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
|
||||
try {
|
||||
methodText = "void foo () {\n" + template.getText(properties) + "\n}";
|
||||
methodText = FileTemplateUtil.indent(methodText, result.getProject(), fileType);
|
||||
} catch (Exception e) {
|
||||
throw new IncorrectOperationException("Failed to parse file template",e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IncorrectOperationException("Failed to parse file template", (Throwable)e);
|
||||
}
|
||||
if (methodText != null) {
|
||||
PsiMethod m;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -253,11 +253,11 @@ public class PackageUtil {
|
||||
}
|
||||
});
|
||||
}
|
||||
catch(IncorrectOperationException e) {
|
||||
catch (IncorrectOperationException e) {
|
||||
throw e;
|
||||
}
|
||||
catch(IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
|
||||
throw ce;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IncorrectOperationException("Incorrect file template", e);
|
||||
throw new IncorrectOperationException("Incorrect file template", (Throwable)e);
|
||||
}
|
||||
catchSection.getCatchBlock().replace(codeBlockFromText);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -89,7 +89,7 @@ public class CreateClassUtil {
|
||||
return (PsiClass)JavaCodeStyleManager.getInstance(project).shortenClassReferences(aClass);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, ANNOTATION, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiAnnotation)) {
|
||||
throw new IncorrectOperationException("Incorrect annotation \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect annotation '" + text + "'");
|
||||
}
|
||||
return (PsiAnnotation)element;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final PsiJavaFile aFile = createDummyJavaFile(StringUtil.join("class _Dummy_ {\n", body, "\n}"));
|
||||
final PsiClass[] classes = aFile.getClasses();
|
||||
if (classes.length != 1) {
|
||||
throw new IncorrectOperationException("Incorrect class \"" + body + "\".");
|
||||
throw new IncorrectOperationException("Incorrect class '" + body + "'");
|
||||
}
|
||||
return classes[0];
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, DECLARATION, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiField)) {
|
||||
throw new IncorrectOperationException("Incorrect field \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect field '" + text + "'");
|
||||
}
|
||||
return (PsiField)element;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, DECLARATION, level), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiMethod)) {
|
||||
throw newException("Incorrect method \"" + text + "\".", holder);
|
||||
throw newException("Incorrect method '" + text + "'", holder);
|
||||
}
|
||||
return (PsiMethod)element;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, PARAMETER, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiParameter)) {
|
||||
throw new IncorrectOperationException("Incorrect parameter \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect parameter '" + text + "'");
|
||||
}
|
||||
return (PsiParameter)element;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, RESOURCE, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiResourceVariable)) {
|
||||
throw new IncorrectOperationException("Incorrect resource \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect resource '" + text + "'");
|
||||
}
|
||||
return (PsiResourceVariable)element;
|
||||
}
|
||||
@@ -259,10 +259,11 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiTypeElement createTypeElementFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, TYPE, level(context)), context);
|
||||
final LanguageLevel level = level(context);
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, TYPE, level), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiTypeElement)) {
|
||||
throw new IncorrectOperationException("Incorrect type \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect type '" + text + "' (" + level + ")");
|
||||
}
|
||||
return (PsiTypeElement)element;
|
||||
}
|
||||
@@ -289,7 +290,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, wrapper, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiJavaCodeReferenceElement)) {
|
||||
throw new IncorrectOperationException("Incorrect reference \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect reference '" + text + "'");
|
||||
}
|
||||
return (PsiJavaCodeReferenceElement)element;
|
||||
}
|
||||
@@ -300,7 +301,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, CODE_BLOCK, level(context), true), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiCodeBlock)) {
|
||||
throw new IncorrectOperationException("Incorrect code block \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect code block '" + text + "'");
|
||||
}
|
||||
return (PsiCodeBlock)element;
|
||||
}
|
||||
@@ -311,7 +312,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, STATEMENT, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiStatement)) {
|
||||
throw new IncorrectOperationException("Incorrect statement \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect statement '" + text + "'");
|
||||
}
|
||||
return (PsiStatement)element;
|
||||
}
|
||||
@@ -322,7 +323,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, EXPRESSION, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiExpression)) {
|
||||
throw new IncorrectOperationException("Incorrect expression \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect expression '" + text + "'");
|
||||
}
|
||||
return (PsiExpression)element;
|
||||
}
|
||||
@@ -339,7 +340,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiTypeParameter)) {
|
||||
throw new IncorrectOperationException("Incorrect type parameter \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect type parameter '" + text + "'");
|
||||
}
|
||||
return (PsiTypeParameter)element;
|
||||
}
|
||||
@@ -359,7 +360,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
}
|
||||
}
|
||||
|
||||
throw new IncorrectOperationException("Incorrect comment \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect comment '" + text + "'");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -368,7 +369,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, ENUM_CONSTANT, level(context)), context);
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
|
||||
if (!(element instanceof PsiEnumConstant)) {
|
||||
throw new IncorrectOperationException("Incorrect enum constant \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect enum constant '" + text + "'");
|
||||
}
|
||||
return (PsiEnumConstant)element;
|
||||
}
|
||||
@@ -378,7 +379,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
public PsiType createPrimitiveType(@NotNull final String text, @NotNull final PsiAnnotation[] annotations) throws IncorrectOperationException {
|
||||
final PsiPrimitiveType primitiveType = getPrimitiveType(text);
|
||||
if (primitiveType == null) {
|
||||
throw new IncorrectOperationException("Incorrect primitive type \"" + text + "\".");
|
||||
throw new IncorrectOperationException("Incorrect primitive type '" + text + "'");
|
||||
}
|
||||
return annotations.length == 0 ? primitiveType : new PsiPrimitiveType(text, annotations);
|
||||
}
|
||||
@@ -396,9 +397,7 @@ public class PsiJavaParserFacadeImpl implements PsiJavaParserFacade {
|
||||
if (root instanceof JavaDummyElement) {
|
||||
final Throwable cause = ((JavaDummyElement)root).getParserError();
|
||||
if (cause != null) {
|
||||
return new IncorrectOperationException(msg) {
|
||||
@Override public Throwable getCause() { return cause; }
|
||||
};
|
||||
return new IncorrectOperationException(msg, cause);
|
||||
}
|
||||
}
|
||||
return new IncorrectOperationException(msg);
|
||||
|
||||
+1
-1
@@ -588,8 +588,8 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
text += parameterList.getText();
|
||||
}
|
||||
PsiJavaCodeReferenceElement ref = facade.getParserFacade().createReferenceFromText(text, getParent());
|
||||
getTreeParent().replaceChildInternal(this, (TreeElement)ref.getNode());
|
||||
((PsiJavaCodeReferenceElementImpl)ref).setAnnotations(annotations);
|
||||
getTreeParent().replaceChildInternal(this, (TreeElement)ref.getNode());
|
||||
|
||||
if (!preserveQualification) {
|
||||
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
|
||||
|
||||
+5
-5
@@ -74,7 +74,7 @@ public class InferenceSession {
|
||||
for (int i = 0; i < leftTypes.length; i++) {
|
||||
final PsiType rightType = mySiteSubstitutor.substitute(rightTypes[i]);
|
||||
if (rightType != null) {
|
||||
myConstraints.add(new TypeCompatibilityConstraint(leftTypes[i], rightType));
|
||||
addConstraint(new TypeCompatibilityConstraint(leftTypes[i], rightType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class InferenceSession {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] != null && isPertinentToApplicability(args[i], method)) {
|
||||
PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
|
||||
myConstraints.add(new ExpressionCompatibilityConstraint(args[i], parameterType));
|
||||
addConstraint(new ExpressionCompatibilityConstraint(args[i], parameterType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ public class InferenceSession {
|
||||
final PsiSubstitutor substitutor = resolveSubset(Collections.singletonList(inferenceVariable), mySiteSubstitutor);
|
||||
final PsiType substitutedReturnType = substitutor.substitute(inferenceVariable.getParameter());
|
||||
if (substitutedReturnType != null) {
|
||||
myConstraints.add(new TypeCompatibilityConstraint(targetType, PsiUtil.captureToplevelWildcards(substitutedReturnType, myContext)));
|
||||
addConstraint(new TypeCompatibilityConstraint(targetType, PsiUtil.captureToplevelWildcards(substitutedReturnType, myContext)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -420,10 +420,10 @@ public class InferenceSession {
|
||||
}
|
||||
final PsiType substitutedCapture = PsiUtil.captureToplevelWildcards(subst.substitute(returnType), myContext);
|
||||
myIncorporationPhase.addCapture(copy, (PsiClassType)returnType);
|
||||
myConstraints.add(new TypeCompatibilityConstraint(targetType, substitutedCapture));
|
||||
addConstraint(new TypeCompatibilityConstraint(targetType, substitutedCapture));
|
||||
}
|
||||
} else {
|
||||
myConstraints.add(new TypeCompatibilityConstraint(targetType, myErased ? TypeConversionUtil.erasure(returnType) : returnType));
|
||||
addConstraint(new TypeCompatibilityConstraint(targetType, myErased ? TypeConversionUtil.erasure(returnType) : returnType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-8
@@ -15,27 +15,30 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.resolve.graphInference;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.PsiTypeParameter;
|
||||
import com.intellij.psi.impl.light.LightTypeParameter;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
*/
|
||||
public class InferenceVariable {
|
||||
public class InferenceVariable extends LightTypeParameter {
|
||||
public PsiTypeParameter getParameter() {
|
||||
return myParameter;
|
||||
return getDelegate();
|
||||
}
|
||||
|
||||
private boolean myThrownBound = false;
|
||||
private final Map<InferenceBound, List<PsiType>> myBounds = new HashMap<InferenceBound, List<PsiType>>();
|
||||
private final PsiTypeParameter myParameter;
|
||||
|
||||
private PsiType myInstantiation = PsiType.NULL;
|
||||
public InferenceVariable(PsiTypeParameter parameter) {
|
||||
myParameter = parameter;
|
||||
|
||||
InferenceVariable(PsiTypeParameter parameter) {
|
||||
super(parameter);
|
||||
}
|
||||
|
||||
public PsiType getInstantiation() {
|
||||
return myInstantiation;
|
||||
}
|
||||
@@ -117,12 +120,13 @@ public class InferenceVariable {
|
||||
myThrownBound = true;
|
||||
}
|
||||
|
||||
public void replaceBounds(InferenceBound boundType, LinkedHashSet<PsiType> bounds) {
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
return this == another || getDelegate() == another;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myParameter.toString();
|
||||
return getDelegate().toString();
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add 'String' as 2nd parameter to method 'f'" "true"
|
||||
import java.util.List;
|
||||
public class S {
|
||||
void f(List<@Anno String> args, String s) {
|
||||
f(null, "");
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add 'String' as 2nd parameter to method 'f'" "true"
|
||||
import java.util.List;
|
||||
public class S {
|
||||
void f(List<@Anno String> args) {
|
||||
f(null, "<caret>");
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
|
||||
public class ChangeMethodSignatureFromUsage8Test extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/changeMethodSignatureFromUsage8";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LanguageLevel getLanguageLevel() {
|
||||
return LanguageLevel.JDK_1_8;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class RenameSuggestionsTest extends LightCodeInsightTestCase {
|
||||
return IdeaTestUtil.getMockJdk18()
|
||||
}
|
||||
|
||||
public void "test by Optional.of initializer"() {
|
||||
public void "test by Optional_of initializer"() {
|
||||
def suggestions = getNameSuggestions("""
|
||||
import java.util.*;
|
||||
class Foo {{
|
||||
@@ -74,7 +74,7 @@ class Foo {{
|
||||
assert suggestions == ["typeValue1", "value", "foo", "fooOptional", "optional", "o"]
|
||||
}
|
||||
|
||||
public void "test by Optional.ofNullable initializer"() {
|
||||
public void "test by Optional_ofNullable initializer"() {
|
||||
def suggestions = getNameSuggestions("""
|
||||
import java.util.*;
|
||||
class Foo {{
|
||||
@@ -85,7 +85,7 @@ class Foo {{
|
||||
assert suggestions == ["typeValue1", "value", "foo", "fooOptional", "optional", "o"]
|
||||
}
|
||||
|
||||
public void "test by Optional.of initializer with constructor"() {
|
||||
public void "test by Optional_of initializer with constructor"() {
|
||||
def suggestions = getNameSuggestions("""
|
||||
import java.util.*;
|
||||
class Foo {{
|
||||
@@ -95,7 +95,7 @@ class Foo {{
|
||||
assert suggestions == ["foo", "fooOptional", "optional", "o"]
|
||||
}
|
||||
|
||||
public void "test by Optional.flatMap"() {
|
||||
public void "test by Optional_flatMap"() {
|
||||
def suggestions = getNameSuggestions("""
|
||||
import java.util.*;
|
||||
class Foo {{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.debugger;
|
||||
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.engine.RemoteStateState;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
@@ -35,6 +36,7 @@ import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -51,6 +53,10 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -136,8 +142,10 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
final RemoteConnection debugParameters = DebuggerManagerImpl.createDebugParameters(javaParameters, debuggerRunnerSettings, false);
|
||||
|
||||
ExecutionEnvironment environment = new ExecutionEnvironment(new MockConfiguration(), DefaultDebugExecutor.getDebugExecutorInstance(),
|
||||
myProject, debuggerRunnerSettings);
|
||||
ExecutionEnvironment environment = new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
|
||||
.setRunnerSettings(debuggerRunnerSettings)
|
||||
.setRunProfile(new MockConfiguration())
|
||||
.build();
|
||||
final JavaCommandLineState javaCommandLineState = new JavaCommandLineState(environment){
|
||||
@Override
|
||||
protected JavaParameters createJavaParameters() {
|
||||
@@ -150,14 +158,20 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
}
|
||||
};
|
||||
|
||||
final GenericDebuggerRunner runner = new GenericDebuggerRunner();
|
||||
|
||||
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
GenericDebuggerRunner runner = new GenericDebuggerRunner();
|
||||
myDebuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(DefaultDebugExecutor.getDebugExecutorInstance(),
|
||||
runner, new MockConfiguration(), javaCommandLineState, debugParameters, false);
|
||||
XDebuggerManager.getInstance(myProject).startSession(runner, javaCommandLineState.getEnvironment(), null, new XDebugProcessStarter() {
|
||||
@Override
|
||||
@NotNull
|
||||
public XDebugProcess start(@NotNull XDebugSession session) {
|
||||
return new JavaDebugProcess(session, myDebuggerSession);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
LOG.error(e);
|
||||
@@ -193,8 +207,10 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
debuggerRunnerSettings.LOCAL = true;
|
||||
debuggerRunnerSettings.DEBUG_PORT = "3456";
|
||||
|
||||
ExecutionEnvironment environment = new ExecutionEnvironment(new MockConfiguration(), DefaultDebugExecutor.getDebugExecutorInstance(), myProject,
|
||||
debuggerRunnerSettings);
|
||||
ExecutionEnvironment environment = new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
|
||||
.setRunnerSettings(debuggerRunnerSettings)
|
||||
.setRunProfile(new MockConfiguration())
|
||||
.build();
|
||||
final JavaCommandLineState javaCommandLineState = new JavaCommandLineState(environment) {
|
||||
@Override
|
||||
protected JavaParameters createJavaParameters() {
|
||||
@@ -214,7 +230,15 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
debuggerSession[0] = attachVirtualMachine(javaCommandLineState, debugParameters, false);
|
||||
GenericDebuggerRunner runner = new GenericDebuggerRunner();
|
||||
debuggerSession[0] = attachVirtualMachine(runner, javaCommandLineState, debugParameters, false);
|
||||
XDebuggerManager.getInstance(myProject).startSession(runner, javaCommandLineState.getEnvironment(), null, new XDebugProcessStarter() {
|
||||
@Override
|
||||
@NotNull
|
||||
public XDebugProcess start(@NotNull XDebugSession session) {
|
||||
return new JavaDebugProcess(session, debuggerSession[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
fail(e.getMessage());
|
||||
@@ -293,7 +317,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
debuggerSession[0] = attachVirtualMachine(remoteState, remoteConnection, pollConnection);
|
||||
debuggerSession[0] = attachVirtualMachine(new GenericDebuggerRunner(), remoteState, remoteConnection, pollConnection);
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
fail(e.getMessage());
|
||||
@@ -445,10 +469,9 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
return myDebuggerSession;
|
||||
}
|
||||
|
||||
protected DebuggerSession attachVirtualMachine(RunProfileState state, RemoteConnection remoteConnection, boolean pollConnection) throws ExecutionException {
|
||||
protected DebuggerSession attachVirtualMachine(ProgramRunner runner, RunProfileState state, RemoteConnection remoteConnection, boolean pollConnection) throws ExecutionException {
|
||||
return DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(DefaultDebugExecutor.getDebugExecutorInstance(),
|
||||
new GenericDebuggerRunner(),
|
||||
new MockConfiguration(), state, remoteConnection, pollConnection);
|
||||
runner, new MockConfiguration(), state, remoteConnection, pollConnection);
|
||||
}
|
||||
|
||||
private static class MockConfiguration implements ModuleRunConfiguration {
|
||||
@@ -517,7 +540,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return ""; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+14
-4
@@ -294,19 +294,29 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
|
||||
if (comment.indexOf("Method") != -1) {
|
||||
breakpoint = breakpointManager.addMethodBreakpoint(document, commentLine + 1);
|
||||
println("MethodBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
if (breakpoint != null) {
|
||||
println("MethodBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2),
|
||||
ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
else if (comment.indexOf("Field") != -1) {
|
||||
breakpoint = breakpointManager.addFieldBreakpoint(document, commentLine + 1, readValue(comment, "Field"));
|
||||
println("FieldBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
if (breakpoint != null) {
|
||||
println("FieldBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
else if (comment.indexOf("Exception") != -1) {
|
||||
breakpoint = breakpointManager.addExceptionBreakpoint(readValue(comment, "Exception"), "");
|
||||
println("ExceptionBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
if (breakpoint != null) {
|
||||
println("ExceptionBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2),
|
||||
ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
else {
|
||||
breakpoint = breakpointManager.addLineBreakpoint(document, commentLine + 1);
|
||||
println("LineBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
if (breakpoint != null) {
|
||||
println("LineBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
|
||||
String suspendPolicy = readValue(comment, "suspendPolicy");
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.engine.jdi.StackFrameProxy;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.LocalVariableDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.DebuggerTreeNode;
|
||||
@@ -176,7 +177,7 @@ public abstract class DescriptorTestCase extends DebuggerTestCase {
|
||||
public void run() {
|
||||
boolean anyCollapsed = false;
|
||||
for(int i = 0; i < tree.getRowCount(); i++) {
|
||||
final DebuggerTreeNode treeNode = (DebuggerTreeNode)tree.getPathForRow(i).getLastPathComponent();
|
||||
final DebuggerTreeNodeImpl treeNode = (DebuggerTreeNodeImpl)tree.getPathForRow(i).getLastPathComponent();
|
||||
if(tree.isCollapsed(i) && !treeNode.isLeaf()) {
|
||||
final NodeDescriptor nodeDescriptor = treeNode.getDescriptor();
|
||||
boolean shouldExpand = filter == null || filter.shouldExpand(treeNode);
|
||||
|
||||
@@ -23,6 +23,9 @@ import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author oleg
|
||||
*/
|
||||
@@ -35,6 +38,21 @@ public abstract class IndentationParser implements PsiParser {
|
||||
private final IElementType myBlockElementType;
|
||||
@NotNull
|
||||
private final IElementType myDocumentType;
|
||||
private final List<IElementType> myContainerTypes;
|
||||
|
||||
public IndentationParser(
|
||||
@NotNull IElementType documentType,
|
||||
@NotNull final IElementType blockElementType,
|
||||
@NotNull final IElementType eolTokenType,
|
||||
@NotNull final IElementType indentTokenType,
|
||||
final List<IElementType> containerTypes)
|
||||
{
|
||||
myDocumentType = documentType;
|
||||
myBlockElementType = blockElementType;
|
||||
myEolTokenType = eolTokenType;
|
||||
myIndentTokenType = indentTokenType;
|
||||
myContainerTypes = containerTypes;
|
||||
}
|
||||
|
||||
public IndentationParser(
|
||||
@NotNull IElementType documentType,
|
||||
@@ -42,18 +60,21 @@ public abstract class IndentationParser implements PsiParser {
|
||||
@NotNull final IElementType eolTokenType,
|
||||
@NotNull final IElementType indentTokenType)
|
||||
{
|
||||
myDocumentType = documentType;
|
||||
myBlockElementType = blockElementType;
|
||||
myEolTokenType = eolTokenType;
|
||||
myIndentTokenType = indentTokenType;
|
||||
this(documentType, blockElementType, eolTokenType, indentTokenType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public final ASTNode parse(final IElementType root, final PsiBuilder builder) {
|
||||
final PsiBuilder.Marker fileMarker = builder.mark();
|
||||
final ArrayList<PsiBuilder.Marker> containerMarkers = new ArrayList<PsiBuilder.Marker>();
|
||||
if (myContainerTypes != null) {
|
||||
for (IElementType ignored : myContainerTypes) {
|
||||
final PsiBuilder.Marker containerMarker = builder.mark();
|
||||
containerMarkers.add(containerMarker);
|
||||
}
|
||||
}
|
||||
final PsiBuilder.Marker documentMarker = builder.mark();
|
||||
|
||||
while (builder.getTokenType() == myEolTokenType) {
|
||||
advanceLexer(builder);
|
||||
}
|
||||
@@ -125,6 +146,14 @@ public abstract class IndentationParser implements PsiParser {
|
||||
}
|
||||
|
||||
documentMarker.done(myDocumentType);
|
||||
|
||||
if (myContainerTypes != null) {
|
||||
for (int i = containerMarkers.size() - 1; i >= 0; i--) {
|
||||
final PsiBuilder.Marker marker = containerMarkers.get(i);
|
||||
marker.done(myContainerTypes.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
fileMarker.done(root);
|
||||
return builder.getTreeBuilt();
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu
|
||||
return copyPsi;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu
|
||||
return newFile;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -550,7 +550,7 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu
|
||||
myFile.delete(myManager);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PsiFileImplUtil {
|
||||
vFile.rename(manager, newName);
|
||||
}
|
||||
catch(IOException e){
|
||||
throw new IncorrectOperationException(e.toString(),e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
|
||||
return file.getViewProvider().isPhysical() ? manager.findFile(vFile) : file;
|
||||
@@ -75,7 +75,7 @@ public class PsiFileImplUtil {
|
||||
vFile.delete(manager);
|
||||
}
|
||||
catch(IOException e){
|
||||
throw new IncorrectOperationException(e.toString(),e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ResolveCache {
|
||||
Getter<TResult> reference = map.get(ref);
|
||||
TResult result = reference == null ? null : reference.get();
|
||||
if (result != null) {
|
||||
return result;
|
||||
//return result;
|
||||
}
|
||||
|
||||
RecursionGuard.StackStamp stamp = myGuard.markStack();
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 1022 B |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -23,7 +23,7 @@ import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -217,7 +217,8 @@ public abstract class RunManager {
|
||||
*/
|
||||
public abstract void refreshUsagesList(RunProfile profile);
|
||||
|
||||
public static String suggestUniqueName(String str, ArrayList<String> currentNames) {
|
||||
@NotNull
|
||||
public static String suggestUniqueName(@NotNull String str, @NotNull Collection<String> currentNames) {
|
||||
if (!currentNames.contains(str)) return str;
|
||||
|
||||
final Matcher matcher = Pattern.compile("(.*?)\\s*\\(\\d+\\)").matcher(str);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -145,15 +145,18 @@ public abstract class RunConfigurationProducer<T extends RunConfiguration> {
|
||||
final RunManager runManager = RunManager.getInstance(context.getProject());
|
||||
final ConfigurationType type = fromContext.getConfigurationType();
|
||||
final List<RunnerAndConfigurationSettings> configurations = runManager.getConfigurationSettingsList(type);
|
||||
final RunnerAndConfigurationSettings configuration = findExistingConfiguration(context);
|
||||
if (configuration != null) {
|
||||
fromContext.setConfigurationSettings(configuration);
|
||||
final RunnerAndConfigurationSettings settings = findExistingConfiguration(context);
|
||||
if (settings != null) {
|
||||
fromContext.setConfigurationSettings(settings);
|
||||
} else {
|
||||
final ArrayList<String> currentNames = new ArrayList<String>();
|
||||
for (RunnerAndConfigurationSettings configurationSettings : configurations) {
|
||||
currentNames.add(configurationSettings.getName());
|
||||
}
|
||||
fromContext.getConfiguration().setName(RunManager.suggestUniqueName(fromContext.getConfiguration().getName(), currentNames));
|
||||
RunConfiguration configuration = fromContext.getConfiguration();
|
||||
String name = configuration.getName();
|
||||
assert name != null : configuration;
|
||||
configuration.setName(RunManager.suggestUniqueName(name, currentNames));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,9 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
|
||||
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor, reuseContent);
|
||||
final ProcessHandler processHandler = descriptor.getProcessHandler();
|
||||
if (processHandler != null) {
|
||||
processHandler.startNotify();
|
||||
if (!processHandler.isStartNotified()) {
|
||||
processHandler.startNotify();
|
||||
}
|
||||
project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processStarted(executor.getId(), env, processHandler);
|
||||
started = true;
|
||||
processHandler.addProcessListener(new ProcessExecutionListener(project, profile, processHandler));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -166,7 +166,7 @@ public class PlatformPackageUtil {
|
||||
throw e;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(), e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -170,7 +170,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
|
||||
|
||||
final Color fg = defaultActionForeground(isSelected, presentation);
|
||||
|
||||
final JLabel actionLabel = createActionLabel(anAction, templatePresentation.getText() + "::" + actionWithParentGroup.getMode(), fg, bg, icon);
|
||||
final JLabel actionLabel = createActionLabel(anAction, templatePresentation.getText(), fg, bg, icon);
|
||||
panel.add(actionLabel, BorderLayout.WEST);
|
||||
|
||||
final String groupName = actionWithParentGroup.getGroupName();
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -63,7 +63,7 @@ public class MoveFilesOrDirectoriesUtil {
|
||||
aDirectory.getVirtualFile().move(manager, destDirectory.getVirtualFile());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(),e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MoveFilesOrDirectoriesUtil {
|
||||
virtualFile.move(manager, newDirectory.getVirtualFile());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IncorrectOperationException(e.toString(),e);
|
||||
throw new IncorrectOperationException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
@@ -47,6 +48,8 @@ import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance(ComponentWithBrowseButton.class);
|
||||
|
||||
private final Comp myComponent;
|
||||
private final FixedSizeButton myBrowseButton;
|
||||
private boolean myButtonEnabled = true;
|
||||
@@ -153,8 +156,7 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
public void dispose() { }
|
||||
|
||||
public FixedSizeButton getButton() {
|
||||
return myBrowseButton;
|
||||
@@ -193,7 +195,22 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
private Project myProject;
|
||||
protected final FileChooserDescriptor myFileChooserDescriptor;
|
||||
|
||||
public BrowseFolderActionListener(@Nullable String title, @Nullable String description, ComponentWithBrowseButton<T> textField, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor, TextComponentAccessor<T> accessor) {
|
||||
public BrowseFolderActionListener(@Nullable String title,
|
||||
@Nullable String description,
|
||||
ComponentWithBrowseButton<T> textField,
|
||||
@Nullable Project project,
|
||||
FileChooserDescriptor fileChooserDescriptor,
|
||||
TextComponentAccessor<T> accessor) {
|
||||
if (fileChooserDescriptor != null && fileChooserDescriptor.isChooseMultiple()) {
|
||||
LOG.error("multiple selection not supported");
|
||||
fileChooserDescriptor = new FileChooserDescriptor(fileChooserDescriptor) {
|
||||
@Override
|
||||
public boolean isChooseMultiple() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
myTitle = title;
|
||||
myDescription = description;
|
||||
myTextComponent = textField;
|
||||
@@ -227,7 +244,7 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
FileChooser.chooseFile(fileChooserDescriptor, getProject(), getInitialFile(), new Consumer<VirtualFile>() {
|
||||
@Override
|
||||
public void consume(VirtualFile file) {
|
||||
onFileChoosen(file);
|
||||
onFileChosen(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -264,9 +281,16 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
return chosenFile.getPresentableUrl();
|
||||
}
|
||||
|
||||
/** @deprecated use/override {@link #onFileChosen(VirtualFile)} (to be removed in IDEA 15) */
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
protected void onFileChoosen(@NotNull VirtualFile chosenFile) {
|
||||
myAccessor.setText(myTextComponent.getChildComponent(), chosenFileToResultingText(chosenFile));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void onFileChosen(@NotNull VirtualFile chosenFile) {
|
||||
onFileChoosen(chosenFile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -274,6 +298,7 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
myComponent.requestFocus();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public final void setNextFocusableComponent(Component aComponent) {
|
||||
super.setNextFocusableComponent(aComponent);
|
||||
@@ -281,9 +306,10 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
}
|
||||
|
||||
private KeyEvent myCurrentEvent = null;
|
||||
|
||||
@Override
|
||||
protected final boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
|
||||
if (condition == WHEN_FOCUSED && myCurrentEvent != e)
|
||||
if (condition == WHEN_FOCUSED && myCurrentEvent != e) {
|
||||
try {
|
||||
myCurrentEvent = e;
|
||||
myComponent.dispatchEvent(e);
|
||||
@@ -291,8 +317,8 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
finally {
|
||||
myCurrentEvent = null;
|
||||
}
|
||||
}
|
||||
if (e.isConsumed()) return true;
|
||||
return super.processKeyBinding(ks, e, condition, pressed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.fileEditor.impl.text.FileDropHandler;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.KeymapManagerListener;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -473,7 +474,11 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
|
||||
VirtualFile file = getCurrentFile();
|
||||
|
||||
File ioFile = file == null ? null : new File(file.getPresentableUrl());
|
||||
String fileTitle = file == null ? null : FrameTitleBuilder.getInstance().getFileTitle(project, file);
|
||||
String fileTitle = null;
|
||||
if (file != null) {
|
||||
fileTitle = DumbService.isDumb(project) ? file.getName()
|
||||
: FrameTitleBuilder.getInstance().getFileTitle(project, file);
|
||||
}
|
||||
|
||||
frame.setFileTitle(fileTitle, ioFile);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -64,7 +64,7 @@ public class LocationNameFieldsBinding {
|
||||
descriptor,
|
||||
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
|
||||
@Override
|
||||
protected void onFileChoosen(@NotNull VirtualFile chosenFile) {
|
||||
protected void onFileChosen(@NotNull VirtualFile chosenFile) {
|
||||
myBaseDir = chosenFile.getPath();
|
||||
if (isProjectNameChanged(nameTextField.getText()) && !nameTextField.getText().equals(chosenFile.getName())) {
|
||||
myExternalModify = true;
|
||||
|
||||
@@ -717,6 +717,12 @@
|
||||
<reference ref="XDebugger.ValueGroup"/>
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.Frames.Tree.Popup">
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.Frames.TopToolbar">
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.Variables.Tree.Popup">
|
||||
<reference ref="XDebugger.ValueGroup"/>
|
||||
<reference ref="XDebugger.JumpToSource"/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.debugger;
|
||||
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.AsyncResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -29,6 +30,12 @@ public interface EvaluateContext {
|
||||
@NotNull
|
||||
EvaluateContext withValueManager(@NotNull String objectGroup);
|
||||
|
||||
/**
|
||||
* If you evaluate "foo.bar = 4" and want to update Variables view (and all other clients), you can use use this task
|
||||
*/
|
||||
@NotNull
|
||||
ActionCallback refreshOnDone(@NotNull ActionCallback result);
|
||||
|
||||
/**
|
||||
* call only if withLoader was called before
|
||||
*/
|
||||
|
||||
+27
-1
@@ -1,10 +1,21 @@
|
||||
package org.jetbrains.debugger;
|
||||
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.AsyncResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.debugger.values.Value;
|
||||
import org.jetbrains.debugger.values.ValueManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class EvaluateContextBase<VALUE_MANAGER extends ValueManager> implements EvaluateContext {
|
||||
protected final VALUE_MANAGER valueManager;
|
||||
|
||||
protected EvaluateContextBase(@NotNull VALUE_MANAGER valueManager) {
|
||||
this.valueManager = valueManager;
|
||||
}
|
||||
|
||||
public abstract class EvaluateContextBase implements EvaluateContext {
|
||||
@NotNull
|
||||
@Override
|
||||
public AsyncResult<Value> evaluate(@NotNull String expression) {
|
||||
@@ -20,4 +31,19 @@ public abstract class EvaluateContextBase implements EvaluateContext {
|
||||
@Override
|
||||
public void releaseObjects() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public abstract AsyncResult<Value> evaluate(@NotNull String expression, @Nullable Map<String, EvaluateContextAdditionalParameter> additionalContext);
|
||||
|
||||
@NotNull
|
||||
public final VALUE_MANAGER getValueManager() {
|
||||
return valueManager;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ActionCallback refreshOnDone(@NotNull ActionCallback result) {
|
||||
return result.doWhenDone(valueManager.getClearCachesTask());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -19,13 +19,22 @@ import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public class IncorrectOperationException extends RuntimeException {
|
||||
public IncorrectOperationException() {
|
||||
this(null);
|
||||
super();
|
||||
}
|
||||
|
||||
public IncorrectOperationException(@NonNls String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public IncorrectOperationException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public IncorrectOperationException(@NonNls String message, Throwable t) {
|
||||
super(message, t);
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #IncorrectOperationException(String, Throwable)} (to be removed in IDEA 15) */
|
||||
public IncorrectOperationException(@NonNls String message, Exception e) {
|
||||
super(message, e);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public class DateFormatUtil {
|
||||
|
||||
boolean loaded = false;
|
||||
try {
|
||||
if (SystemInfo.isWinVistaOrNewer) {
|
||||
if (SystemInfo.isWin7OrNewer) {
|
||||
loaded = getWindowsFormats(formats);
|
||||
}
|
||||
else if (SystemInfo.isMac) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user