diff options
author | wisberg <wisberg> | 2003-05-05 15:10:46 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-05-05 15:10:46 +0000 |
commit | d2cba1ffb6bfa8beedbd530fa0ec0e879da374ee (patch) | |
tree | ad5b5788d8e4db235dfae804e11fe2ba4ef82ba8 /ajde/src | |
parent | 7d043c7a6303051f25f397b42c10fc42bfaccd9c (diff) | |
download | aspectj-d2cba1ffb6bfa8beedbd530fa0ec0e879da374ee.tar.gz aspectj-d2cba1ffb6bfa8beedbd530fa0ec0e879da374ee.zip |
NPE guard
Diffstat (limited to 'ajde/src')
-rw-r--r-- | ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java | 9 | ||||
-rw-r--r-- | ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java index 68f7741aa..a1798c125 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java @@ -27,6 +27,7 @@ import org.aspectj.asm.InheritanceAssociation; import org.aspectj.asm.LinkNode; import org.aspectj.asm.ProgramElementNode; import org.aspectj.asm.StructureNode; +import org.aspectj.bridge.ISourceLocation; /** * Responsible for displaying and controlling the configuration and output of a @@ -74,8 +75,12 @@ public class BrowserViewManager { } else { currNode = (ProgramElementNode)structureNode; } - Ajde.getDefault().getEditorManager().addViewForSourceLine(currNode.getSourceLocation().getSourceFile().getAbsolutePath(), - currNode.getSourceLocation().getLine()); + ISourceLocation sourceLoc = currNode.getSourceLocation(); + if (null != sourceLoc) { + Ajde.getDefault().getEditorManager().addViewForSourceLine( + sourceLoc.getSourceFile().getAbsolutePath(), + sourceLoc.getLine()); + } } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java index 66f73fb69..a2ba8a601 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java @@ -27,6 +27,7 @@ import org.aspectj.asm.ProgramElementNode; import org.aspectj.asm.RelationNode; import org.aspectj.asm.StructureNode; import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.ISourceLocation; /** * @author Mik Kersten @@ -45,10 +46,12 @@ class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer { StructureNode node = viewNode.getStructureNode(); if (node instanceof LinkNode) { - if (((LinkNode)node).getProgramElementNode().getSourceLocation().getSourceFile().getAbsolutePath() == null) { - setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR); - } else { + ISourceLocation sourceLoc = ((LinkNode)node).getProgramElementNode().getSourceLocation(); + if ((null != sourceLoc) + && (null != sourceLoc.getSourceFile().getAbsolutePath())) { setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_COLOR); + } else { + setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR); } } else { setTextNonSelectionColor(new Color(0, 0, 0)); |