private GroovyTreeNode(GroovyTreeNode parent, GroovyNode node) { this.parent = parent; this.node = node; for (Map.Entry<String, String> entry : node.attributes().entrySet()) { children.add(new GroovyTreeNode(this, entry.getKey(), entry.getValue())); } if (node.getNodeValue() instanceof List) { string = node.getNodeName(); toolTip = String.format("Size: %d", ((List) node.getNodeValue()).size()); } else { String truncated = node.text(); if (truncated.contains("\n") || truncated.length() >= MAX_LENGTH) { int index = truncated.indexOf('\n'); if (index > 0) truncated = truncated.substring(0, index); if (truncated.length() >= MAX_LENGTH) truncated = truncated.substring(0, MAX_LENGTH); string = String.format("<html><b>%s</b> = %s ...</html>", node.getNodeName(), truncated); toolTip = tameTooltipText(node.text()); } else { string = String.format("<html><b>%s</b> = %s</html>", node.getNodeName(), truncated); toolTip = truncated; } } if (this.node.getNodeValue() instanceof List) { for (Object sub : ((List) this.node.getNodeValue())) { GroovyNode subnode = (GroovyNode) sub; children.add(new GroovyTreeNode(this, subnode)); } Collections.sort(children); } }
@NotNull private Set<Usage> getReadOnlyUsages() { final Set<Usage> result = new THashSet<Usage>(); final Set<Map.Entry<Usage, UsageNode>> usages = myUsageNodes.entrySet(); for (Map.Entry<Usage, UsageNode> entry : usages) { Usage usage = entry.getKey(); UsageNode node = entry.getValue(); if (node != null && node != NULL_NODE && !node.isExcluded() && usage.isReadOnly()) { result.add(usage); } } return result; }
@Override @NotNull public Set<Usage> getExcludedUsages() { Set<Usage> result = new THashSet<Usage>(); for (Map.Entry<Usage, UsageNode> entry : myUsageNodes.entrySet()) { UsageNode node = entry.getValue(); Usage usage = entry.getKey(); if (node == NULL_NODE || node == null) { continue; } if (node.isExcluded()) { result.add(usage); } } return result; }
void populateTable(HashMap data) { String key, strval = "<null>"; Object val; int num_rows = 0; Map.Entry entry; if (data == null) return; num_rows = data.size(); clearTable(); if (num_rows > 0) { for (Iterator it = data.entrySet().iterator(); it.hasNext(); ) { entry = (Map.Entry) it.next(); key = (String) entry.getKey(); val = entry.getValue(); if (val != null) strval = val.toString(); table_model.addRow(new Object[] {key, strval}); } table_model.fireTableRowsInserted(0, num_rows - 1); validate(); } }