Take the chance to display attributes correctly in the designer
This commit is contained in:
@ -6,6 +6,7 @@ package net.sourceforge.pmd.util.fxdesigner;
|
|||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.ResourceBundle;
|
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.Node;
|
||||||
import net.sourceforge.pmd.lang.ast.xpath.Attribute;
|
import net.sourceforge.pmd.lang.ast.xpath.Attribute;
|
||||||
import net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator;
|
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.java.ast.TypeNode;
|
||||||
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
|
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
|
||||||
import net.sourceforge.pmd.util.fxdesigner.model.MetricEvaluator;
|
import net.sourceforge.pmd.util.fxdesigner.model.MetricEvaluator;
|
||||||
@ -138,9 +140,10 @@ public class NodeInfoPanelController implements Initializable {
|
|||||||
*/
|
*/
|
||||||
private static ObservableList<String> getAttributes(Node node) {
|
private static ObservableList<String> getAttributes(Node node) {
|
||||||
ObservableList<String> result = FXCollections.observableArrayList();
|
ObservableList<String> result = FXCollections.observableArrayList();
|
||||||
AttributeAxisIterator attributeAxisIterator = new AttributeAxisIterator(node);
|
Iterator<Attribute> attributeAxisIterator = node instanceof AttributeNode ? ((AttributeNode) node).getAttributeIterator() : new AttributeAxisIterator(node);
|
||||||
while (attributeAxisIterator.hasNext()) {
|
while (attributeAxisIterator.hasNext()) {
|
||||||
Attribute attribute = attributeAxisIterator.next();
|
Attribute attribute = attributeAxisIterator.next();
|
||||||
|
// TODO the display should be handled in a ListCell
|
||||||
result.add(attribute.getName() + " = "
|
result.add(attribute.getName() + " = "
|
||||||
+ ((attribute.getValue() != null) ? attribute.getStringValue() : "null"));
|
+ ((attribute.getValue() != null) ? attribute.getStringValue() : "null"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user