use of com.intellij.ide.util.treeView.AbstractTreeNode in project intellij-community by JetBrains.
the class CommanderPanel method drillDown.
public void drillDown() {
if (topElementIsSelected()) {
goUp();
return;
}
if (getSelectedValue() == null) {
return;
}
final AbstractTreeNode element = getSelectedNode();
if (element.getChildren().isEmpty()) {
if (!shouldDrillDownOnEmptyElement(element)) {
navigateSelectedElement();
return;
}
}
if (myBuilder == null) {
return;
}
updateHistory(false);
myBuilder.drillDown();
updateHistory(true);
}
use of com.intellij.ide.util.treeView.AbstractTreeNode in project intellij-community by JetBrains.
the class FavoritesListNode method processUrls.
private static void processUrls(Project project, Collection<TreeItem<Pair<AbstractUrl, String>>> urls, Collection<AbstractTreeNode> result, final AbstractTreeNode me) {
for (TreeItem<Pair<AbstractUrl, String>> pair : urls) {
AbstractUrl abstractUrl = pair.getData().getFirst();
final Object[] path = abstractUrl.createPath(project);
if (path == null || path.length < 1 || path[0] == null) {
continue;
}
try {
final String className = pair.getData().getSecond();
@SuppressWarnings("unchecked") final Class<? extends AbstractTreeNode> nodeClass = (Class<? extends AbstractTreeNode>) Class.forName(className);
final AbstractTreeNode node = ProjectViewNode.createTreeNode(nodeClass, project, path[path.length - 1], FavoritesManager.getInstance(project).getViewSettings());
node.setParent(me);
node.setIndex(result.size());
result.add(node);
if (node instanceof ProjectViewNodeWithChildrenList) {
final List<TreeItem<Pair<AbstractUrl, String>>> children = pair.getChildren();
if (children != null && !children.isEmpty()) {
Collection<AbstractTreeNode> childList = new ArrayList<>();
processUrls(project, children, childList, node);
for (AbstractTreeNode treeNode : childList) {
((ProjectViewNodeWithChildrenList) node).addChild(treeNode);
}
}
}
} catch (Exception e) {
LOGGER.error(e);
}
}
}
use of com.intellij.ide.util.treeView.AbstractTreeNode in project intellij-community by JetBrains.
the class AbstractListBuilder method drillDown.
public final void drillDown() {
final Object value = getSelectedValue();
if (value instanceof AbstractTreeNode) {
try {
final AbstractTreeNode node = (AbstractTreeNode) value;
buildList(node);
ensureSelectionExist();
} finally {
updateParentTitle();
}
} else {
// an element that denotes parent
goUp();
}
}
use of com.intellij.ide.util.treeView.AbstractTreeNode in project intellij-community by JetBrains.
the class AbstractListBuilder method buildList.
private void buildList(final AbstractTreeNode parentElement) {
myCurrentParent = parentElement;
Future<?> future = AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> myList.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)), 200, TimeUnit.MILLISECONDS);
final Object[] children = getChildren(parentElement);
myModel.removeAllElements();
if (shouldAddTopElement()) {
myModel.addElement(new TopLevelNode(myProject, parentElement.getValue()));
}
for (Object aChildren : children) {
AbstractTreeNode child = (AbstractTreeNode) aChildren;
child.update();
}
if (myComparator != null) {
Arrays.sort(children, myComparator);
}
for (Object aChildren : children) {
myModel.addElement(aChildren);
}
boolean canceled = future.cancel(false);
if (!canceled) {
AppExecutorUtil.getAppExecutorService().execute(() -> myList.setCursor(Cursor.getDefaultCursor()));
}
}
use of com.intellij.ide.util.treeView.AbstractTreeNode in project intellij-community by JetBrains.
the class AbstractListBuilder method goUp.
public final void goUp() {
if (myCurrentParent == myShownRoot.getParent()) {
return;
}
final AbstractTreeNode element = myCurrentParent.getParent();
if (element == null) {
return;
}
try {
AbstractTreeNode oldParent = myCurrentParent;
buildList(element);
for (int i = 0; i < myModel.getSize(); i++) {
if (myModel.getElementAt(i) instanceof NodeDescriptor) {
final NodeDescriptor desc = (NodeDescriptor) myModel.getElementAt(i);
final Object elem = desc.getElement();
if (oldParent.equals(elem)) {
selectItem(i);
break;
}
}
}
} finally {
updateParentTitle();
}
}
Aggregations