diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java index f3fddaf9e8..ef594572fc 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/NodeInfoPanelController.java @@ -6,6 +6,7 @@ package net.sourceforge.pmd.util.fxdesigner; import java.net.URL; import java.util.Collections; +import java.util.Iterator; import java.util.Objects; import java.util.ResourceBundle; @@ -14,6 +15,7 @@ import org.reactfx.EventStreams; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.xpath.Attribute; import net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator; +import net.sourceforge.pmd.lang.ast.xpath.AttributeNode; import net.sourceforge.pmd.lang.java.ast.TypeNode; import net.sourceforge.pmd.lang.symboltable.NameDeclaration; import net.sourceforge.pmd.util.fxdesigner.model.MetricEvaluator; @@ -138,9 +140,10 @@ public class NodeInfoPanelController implements Initializable { */ private static ObservableList getAttributes(Node node) { ObservableList result = FXCollections.observableArrayList(); - AttributeAxisIterator attributeAxisIterator = new AttributeAxisIterator(node); + Iterator attributeAxisIterator = node instanceof AttributeNode ? ((AttributeNode) node).getAttributeIterator() : new AttributeAxisIterator(node); while (attributeAxisIterator.hasNext()) { Attribute attribute = attributeAxisIterator.next(); + // TODO the display should be handled in a ListCell result.add(attribute.getName() + " = " + ((attribute.getValue() != null) ? attribute.getStringValue() : "null")); }