use of javax.swing.tree.TreePath in project intellij-community by JetBrains.
the class RepositoryBrowserComponent method setSelectedNode.
public void setSelectedNode(@NotNull final TreeNode node) {
final TreeNode[] pathNodes = ((RepositoryTreeModel) myRepositoryTree.getModel()).getPathToRoot(node);
myRepositoryTree.setSelectionPath(new TreePath(pathNodes));
}
use of javax.swing.tree.TreePath in project intellij-community by JetBrains.
the class PyViewNumericContainerAction method update.
@Override
public void update(AnActionEvent e) {
e.getPresentation().setVisible(false);
TreePath[] paths = getSelectedPaths(e.getDataContext());
if (paths != null) {
if (paths.length > 1) {
e.getPresentation().setVisible(false);
return;
}
XValueNodeImpl node = getSelectedNode(e.getDataContext());
if (node != null && node.getValueContainer() instanceof PyDebugValue && node.isComputed()) {
PyDebugValue debugValue = (PyDebugValue) node.getValueContainer();
String nodeType = debugValue.getType();
if ("ndarray".equals(nodeType)) {
e.getPresentation().setText("View as Array");
e.getPresentation().setVisible(true);
} else if (("DataFrame".equals(nodeType))) {
e.getPresentation().setText("View as DataFrame");
e.getPresentation().setVisible(true);
} else {
e.getPresentation().setVisible(false);
}
} else {
e.getPresentation().setVisible(false);
}
}
}
use of javax.swing.tree.TreePath in project intellij-community by JetBrains.
the class AssociationsEditor method expandTree.
private void expandTree(DefaultTreeModel newModel) {
final TreePath rootPath = new TreePath(newModel.getRoot());
final Object element = myBuilder.getTreeStructure().getRootElement();
myBuilder.batch(new Progressive() {
@Override
public void run(@NotNull ProgressIndicator indicator) {
myBuilder.expand(element, null);
myBuilder.expand(myBuilder.getTreeStructure().getChildElements(element), null);
}
});
myTree.setSelectionPath(rootPath);
myTree.scrollRectToVisible(new Rectangle(new Point(0, 0)));
}
use of javax.swing.tree.TreePath in project intellij-community by JetBrains.
the class ComponentTree method getSelectedComponents.
/**
* TODO[vova] should return pair <RadComponent, TreePath>
*
* @return currently selected components.
*/
@NotNull
public RadComponent[] getSelectedComponents() {
final TreePath[] paths = getSelectionPaths();
if (paths == null) {
return RadComponent.EMPTY_ARRAY;
}
final ArrayList<RadComponent> result = new ArrayList<>(paths.length);
for (TreePath path : paths) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
if (node != null && node.getUserObject() instanceof ComponentPtrDescriptor) {
final ComponentPtrDescriptor descriptor = (ComponentPtrDescriptor) node.getUserObject();
final ComponentPtr ptr = descriptor.getElement();
if (ptr != null && ptr.isValid()) {
result.add(ptr.getComponent());
}
}
}
return result.toArray(new RadComponent[result.size()]);
}
use of javax.swing.tree.TreePath in project intellij-community by JetBrains.
the class ComponentTree method getToolTipText.
@Nullable
public String getToolTipText(final MouseEvent e) {
final TreePath path = getPathForLocation(e.getX(), e.getY());
final RadComponent component = getComponentFromPath(path);
if (component != null) {
final ErrorInfo errorInfo = ErrorAnalyzer.getErrorForComponent(component);
if (errorInfo != null) {
return errorInfo.myDescription;
}
}
return null;
}
Aggregations