From b7705092d849b6193aeed553cac33124fbc52238 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 5 Mar 2014 11:02:18 +0100 Subject: [PATCH] cleanup --- .../ui/impl/watch/MessageDescriptor.java | 4 ++++ .../ui/impl/watch/NodeDescriptorImpl.java | 19 ++++++++++++++----- .../impl/watch/StackFrameDescriptorImpl.java | 15 +++++++++++---- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java index 026f2ad6b4b9..6f2aa4e09f0d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java @@ -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; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorImpl.java index a009733a39a9..f2f5b1c23283 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorImpl.java @@ -52,15 +52,21 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor { private final List myChildren = new ArrayList(); private static final Key> MARKUP_MAP_KEY = new Key>("ValueMarkupMap"); + @Override public String getName() { return null; } + @Override public T getUserData(Key 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 void putUserData(Key key, T value) { if(myUserData == null) { myUserData = new HashMap(); @@ -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); } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java index 41a5384ae19b..71a5e4d6d916 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java @@ -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; }