use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method getNodesTree.
/**
* This method initializes jTree1
*
* @return javax.swing.JTree
*/
private JTree getNodesTree() {
if (nodesTree == null) {
nodesTree = new JTree(new DefaultMutableTreeNode("ROOT"));
nodesTree.setRootVisible(false);
nodesTree.setCellRenderer(new ErrorTreeCellRenderer());
nodesTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
complexNodeSelected = (DefaultMutableTreeNode) nodesTree.getLastSelectedPathComponent();
if (complexNodeSelected != null)
complexSelected = (ComplexObject) complexNodeSelected.getUserObject();
refreshNodeAttributesTable();
refreshMembersTable();
}
});
}
ToolTipManager.sharedInstance().registerComponent(nodesTree);
return nodesTree;
}
use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class LogLvlTreeModel method removeComponent.
/**
* Remove all the occurrencies of the component with the given
* handle from the tree
*
* @param handle The handle of the component to remove
*/
private void removeComponent(int handle) {
// Look for a node with the given handle
DefaultMutableTreeNode compNode = findNode(containersNode, null, handle);
if (compNode == null) {
// The node is not in the tree: nothing to do
return;
}
DefaultMutableTreeNode parent = (DefaultMutableTreeNode) compNode.getParent();
int idx = parent.getIndex(compNode);
parent.remove(compNode);
Object[] children = new Object[] { compNode };
int[] indexes = new int[] { idx };
fireTreeNodesRemoved(parent, parent.getPath(), indexes, children);
}
use of javax.swing.tree.DefaultMutableTreeNode in project intellij-community by JetBrains.
the class DynamicToolWindowWrapper method deleteRow.
void deleteRow() {
boolean isShowDialog = true;
final int rowsCount = myTreeTable.getSelectedRows().length;
int i = 0;
final TreePath[] paths = myTreeTable.getTree().getSelectionPaths();
if (paths == null)
return;
for (TreePath selectionPath : paths) {
if (rowsCount > 1)
isShowDialog = false;
if (i == 0)
isShowDialog = true;
i++;
//class
final TreePath parent = selectionPath.getParentPath();
if (parent.getParentPath() == null) {
//selectionPath is class
final Object classRow = selectionPath.getLastPathComponent();
if (!(classRow instanceof DefaultMutableTreeNode))
return;
if (!removeClass(((DefaultMutableTreeNode) classRow), isShowDialog, rowsCount))
return;
} else {
//selectionPath is dynamic item
final Object classRow = parent.getLastPathComponent();
final Object dynamicRow = selectionPath.getLastPathComponent();
if (!(classRow instanceof DefaultMutableTreeNode))
return;
if (!(dynamicRow instanceof DefaultMutableTreeNode))
return;
final DefaultMutableTreeNode dynamicItemNode = (DefaultMutableTreeNode) dynamicRow;
final DefaultMutableTreeNode classNode = (DefaultMutableTreeNode) classRow;
final boolean removeClass = classNode.getChildCount() == 1;
if (!removeDynamicElement(dynamicItemNode, isShowDialog, rowsCount))
return;
if (removeClass) {
removeNamedElement((DNamedElement) classNode.getUserObject());
}
}
}
DynamicManager.getInstance(myProject).fireChange();
}
use of javax.swing.tree.DefaultMutableTreeNode in project intellij-community by JetBrains.
the class DynamicToolWindowWrapper method buildTree.
private DefaultMutableTreeNode buildTree(DefaultMutableTreeNode rootNode) {
final Collection<DClassElement> containingClasses = DynamicManager.getInstance(myProject).getAllContainingClasses();
DefaultMutableTreeNode containingClassNode;
for (DClassElement containingClassElement : containingClasses) {
containingClassNode = new DefaultMutableTreeNode(containingClassElement);
final Collection<DPropertyElement> properties = DynamicManager.getInstance(myProject).findDynamicPropertiesOfClass(containingClassElement.getName());
// if (properties.length == 0) continue;
DefaultMutableTreeNode propertyTreeNode;
for (DPropertyElement property : properties) {
propertyTreeNode = new DefaultMutableTreeNode(property);
containingClassNode.add(propertyTreeNode);
}
DefaultMutableTreeNode methodTreeNode;
final Set<DMethodElement> methods = containingClassElement.getMethods();
for (DMethodElement methodElement : methods) {
final String[] psiTypes = QuickfixUtil.getArgumentsTypes(methodElement.getPairs());
final DMethodElement method = DynamicManager.getInstance(myProject).findConcreteDynamicMethod(containingClassElement.getName(), methodElement.getName(), psiTypes);
methodTreeNode = new DefaultMutableTreeNode(method);
containingClassNode.add(methodTreeNode);
}
rootNode.add(containingClassNode);
}
return rootNode;
}
use of javax.swing.tree.DefaultMutableTreeNode in project intellij-community by JetBrains.
the class DynamicToolWindowWrapper method rebuildTreePanel.
public void rebuildTreePanel() {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
buildTree(rootNode);
rebuildTreeView(rootNode, false);
}
Aggregations