@Override public void selectAstNode(AstNode astNode) { if (astNode != null) { try { astSelectionEventDisabled = true; DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode); astTree.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath())); } finally { astSelectionEventDisabled = false; } } }
public void addSelectionPath(TreePath path) { if (canPathBeAdded(path)) { selectionModel.addSelectionPath(path);
@Override public void selectAstNode(AstNode astNode) { if (astNode != null) { try { astSelectionEventDisabled = true; DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode); astTree.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath())); } finally { astSelectionEventDisabled = false; } } }
@Override public void selectAstNode(AstNode astNode) { if (astNode != null) { try { astSelectionEventDisabled = true; DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode); astTree.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath())); } finally { astSelectionEventDisabled = false; } } }
@Override public void addSelectionPath(TreePath path) { getUI().getTreeSelectionModel().addSelectionPath(path); }
private void selectAll() { selectAllInProgress = true; TreeNode[] path = new TreeNode[3]; path[0] = root; for(int i = 0; i < root.getChildCount(); i++) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(i); path[1] = node; for(int j = 0; j < node.getChildCount(); j++) { DefaultMutableTreeNode node2 = (DefaultMutableTreeNode) node.getChildAt(j); path[2] = node2; bufferTree.getSelectionModel() .addSelectionPath( new TreePath(path)); } } selectAllInProgress = false; updateEnabled(); } //}}}
public void run() { ICollectionConnector connector = (ICollectionConnector) evt .getSource(); int[] oldSelection = evt.getOldSelection(); int[] newSelection = evt.getNewSelection(); if (oldSelection != null) { for (int i : oldSelection) { if (newSelection == null || Arrays.binarySearch(newSelection, i) < 0) { selectionModel .removeSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } if (newSelection != null) { for (int i : newSelection) { if (oldSelection == null || Arrays.binarySearch(oldSelection, i) < 0) { selectionModel .addSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } } });
@Override public void run() { ICollectionConnector connector = (ICollectionConnector) evt .getSource(); int[] oldSelection = evt.getOldSelection(); int[] newSelection = evt.getNewSelection(); if (oldSelection != null) { for (int i : oldSelection) { if (newSelection == null || Arrays.binarySearch(newSelection, i) < 0) { selectionModel .removeSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } if (newSelection != null) { for (int i : newSelection) { if (oldSelection == null || Arrays.binarySearch(oldSelection, i) < 0) { selectionModel .addSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } } });
/** * {@inheritDoc} */ public void selectionChange(SelectionChangeEvent evt) { ICollectionConnector connector = (ICollectionConnector) evt.getSource(); int[] oldSelection = evt.getOldSelection(); int[] newSelection = evt.getNewSelection(); if (oldSelection != null) { for (int i : oldSelection) { if (newSelection == null || Arrays.binarySearch(newSelection, i) < 0) { selectionModel .removeSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } if (newSelection != null) { for (int i : newSelection) { if (oldSelection == null || Arrays.binarySearch(oldSelection, i) < 0) { selectionModel.addSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } }
/** * {@inheritDoc} */ public void selectionChange(SelectionChangeEvent evt) { ICollectionConnector connector = (ICollectionConnector) evt.getSource(); int[] oldSelection = evt.getOldSelection(); int[] newSelection = evt.getNewSelection(); if (oldSelection != null) { for (int i : oldSelection) { if (newSelection == null || Arrays.binarySearch(newSelection, i) < 0) { selectionModel .removeSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } if (newSelection != null) { for (int i : newSelection) { if (oldSelection == null || Arrays.binarySearch(oldSelection, i) < 0) { selectionModel.addSelectionPath(getTreePathForConnector(connector .getChildConnector(i))); } } } }
treetable.getTreeSelectionModel().clearSelection(); } else { treetable.getTreeSelectionModel().addSelectionPath(path);