Search in sources :

Example 1 with NodeLabel

use of com.intellij.openapi.graph.view.NodeLabel in project intellij-plugins by JetBrains.

the class StrutsDataModel method addNode.

private void addNode(final BasicStrutsNode node) {
    if (!node.getIdentifyingElement().isValid()) {
        return;
    }
    myNodes.add(node);
    if (isGroupElements()) {
        final XmlElement element = node.getIdentifyingElement().getXmlElement();
        assert element != null;
        final PsiFile file = element.getContainingFile();
        if (file != null && !myGroups.containsKey(file)) {
            final String name = file.getName();
            final BasicNodesGroup group = new BasicNodesGroup(name) {

                @Nullable
                public GroupNodeRealizer getGroupNodeRealizer() {
                    final GroupNodeRealizer groupNodeRealizer = super.getGroupNodeRealizer();
                    assert groupNodeRealizer != null;
                    final NodeLabel nodeLabel = groupNodeRealizer.getLabel();
                    nodeLabel.setText("      " + getGroupName());
                    nodeLabel.setModel(NodeLabel.INTERNAL);
                    nodeLabel.setPosition(NodeLabel.TOP_RIGHT);
                    return groupNodeRealizer;
                }
            };
            // collapse all other files
            group.setClosed(file != myFile);
            myGroups.put(file, group);
        }
    }
}
Also used : GroupNodeRealizer(com.intellij.openapi.graph.view.hierarchy.GroupNodeRealizer) NodeLabel(com.intellij.openapi.graph.view.NodeLabel) XmlElement(com.intellij.psi.xml.XmlElement) PsiFile(com.intellij.psi.PsiFile) BasicNodesGroup(com.intellij.openapi.graph.builder.components.BasicNodesGroup)

Aggregations

BasicNodesGroup (com.intellij.openapi.graph.builder.components.BasicNodesGroup)1 NodeLabel (com.intellij.openapi.graph.view.NodeLabel)1 GroupNodeRealizer (com.intellij.openapi.graph.view.hierarchy.GroupNodeRealizer)1 PsiFile (com.intellij.psi.PsiFile)1 XmlElement (com.intellij.psi.xml.XmlElement)1