This commit is contained in:
Vladimir Krivosheev
2014-03-05 12:03:07 +01:00
parent 7d78ad3f55
commit b7705092d8
3 changed files with 29 additions and 9 deletions
@@ -59,17 +59,21 @@ public class MessageDescriptor extends NodeDescriptorImpl {
return myKind;
}
@Override
public String getLabel() {
return myMessage;
}
@Override
public boolean isExpandable() {
return false;
}
@Override
public void setContext(EvaluationContextImpl context) {
}
@Override
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
DebuggerManagerThreadImpl.assertIsManagerThread();
return myMessage;
@@ -52,15 +52,21 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
private final List<NodeDescriptorImpl> myChildren = new ArrayList<NodeDescriptorImpl>();
private static final Key<Map<ObjectReference, ValueMarkup>> MARKUP_MAP_KEY = new Key<Map<ObjectReference, ValueMarkup>>("ValueMarkupMap");
@Override
public String getName() {
return null;
}
@Override
public <T> T getUserData(Key<T> key) {
if(myUserData == null) return null;
return (T) myUserData.get(key);
if (myUserData == null) {
return null;
}
//noinspection unchecked
return (T)myUserData.get(key);
}
@Override
public <T> void putUserData(Key<T> key, T value) {
if(myUserData == null) {
myUserData = new HashMap<Key, Object>();
@@ -91,12 +97,12 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
protected abstract String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException;
private EvaluateException processException(Exception e) {
if(e instanceof InconsistentDebugInfoException) {
private static EvaluateException processException(Exception e) {
if (e instanceof InconsistentDebugInfoException) {
return new EvaluateException(DebuggerBundle.message("error.inconsistent.debug.info"), null);
}
else if(e instanceof InvalidStackFrameException) {
else if (e instanceof InvalidStackFrameException) {
return new EvaluateException(DebuggerBundle.message("error.invalid.stackframe"), null);
}
else {
@@ -104,6 +110,7 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
}
}
@Override
public void displayAs(NodeDescriptor descriptor) {
if (descriptor instanceof NodeDescriptorImpl) {
final NodeDescriptorImpl that = (NodeDescriptorImpl)descriptor;
@@ -122,6 +129,7 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
return myEvaluateException;
}
@Override
public String getLabel() {
return myLabel;
}
@@ -149,6 +157,7 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
return myChildren;
}
@Override
public void setAncestor(NodeDescriptor oldDescriptor) {
displayAs(oldDescriptor);
}
@@ -67,6 +67,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
myMethodOccurrence = tracker.getMethodOccurrence(myLocation.method());
myIsSynthetic = DebuggerUtils.isSynthetic(myMethodOccurrence.getMethod());
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
final SourcePosition position = ContextUtil.getSourcePosition(StackFrameDescriptorImpl.this);
final PsiFile file = position != null? position.getFile() : null;
@@ -103,10 +104,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
return myUiIndex;
}
@Override
public StackFrameProxyImpl getFrameProxy() {
return myFrame;
}
@Override
public DebugProcess getDebugProcess() {
return myFrame.getVirtualMachine().getDebugProcess();
}
@@ -140,10 +143,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
return null;
}
@Override
public String getName() {
return myName;
}
@Override
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener descriptorLabelListener) throws EvaluateException {
DebuggerManagerThreadImpl.assertIsManagerThread();
if (myLocation == null) {
@@ -159,7 +164,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
label.append("()");
}
if (settings.SHOW_LINE_NUMBER) {
String lineNumber = null;
String lineNumber;
try {
lineNumber = Integer.toString(myLocation.lineNumber());
}
@@ -172,7 +177,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
}
}
if (settings.SHOW_CLASS_NAME) {
String name = null;
String name;
try {
ReferenceType refType = myLocation.declaringType();
name = refType != null ? refType.name() : null;
@@ -206,7 +211,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
label.append(", ");
label.append(sourceName);
}
catch (AbsentInformationException exception) {
catch (AbsentInformationException ignored) {
}
}
return label.toString();
@@ -220,10 +225,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
return getFrameProxy().equals(d.getFrameProxy());
}
@Override
public boolean isExpandable() {
return true;
}
@Override
public final void setContext(EvaluationContextImpl context) {
myIcon = calcIcon();
}
@@ -246,7 +253,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
return AllIcons.Debugger.Db_obsolete;
}
}
catch (EvaluateException e) {
catch (EvaluateException ignored) {
}
return AllIcons.Debugger.StackFrame;
}