mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
TreeUtil: 'childrenToArray' method renamed to 'listChildren'
To make name of the method consistent with its return type.
This commit is contained in:
+2
-2
@@ -181,7 +181,7 @@ public class ExternalProjectDataSelectorDialog extends DialogWrapper {
|
||||
final Couple<CheckedTreeNode> rootAndPreselectedNode = createRoot();
|
||||
final CheckedTreeNode rootCopy = rootAndPreselectedNode.first;
|
||||
|
||||
List<TreeNode> nodes = TreeUtil.childrenToArray(rootCopy);
|
||||
List<TreeNode> nodes = TreeUtil.listChildren(rootCopy);
|
||||
rootNode.removeAllChildren();
|
||||
TreeUtil.addChildrenTo(rootNode, nodes);
|
||||
treeModel.reload();
|
||||
@@ -391,7 +391,7 @@ public class ExternalProjectDataSelectorDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
List<TreeNode> nodes = projectNode != null ? TreeUtil.childrenToArray(projectNode) : ContainerUtil.emptyList();
|
||||
List<TreeNode> nodes = projectNode != null ? TreeUtil.listChildren(projectNode) : ContainerUtil.emptyList();
|
||||
Collections.sort(nodes, (o1, o2) -> {
|
||||
if(o1 instanceof DataNodeCheckedTreeNode && o2 instanceof DataNodeCheckedTreeNode) {
|
||||
if (rootModuleComment.equals(((DataNodeCheckedTreeNode)o1).comment)) return -1;
|
||||
|
||||
+2
-2
@@ -124,7 +124,7 @@ class ModuleGroupingTreeHelper<N: MutableTreeNode> private constructor(
|
||||
}
|
||||
|
||||
private fun moveChildren(fromNode: N, toNode: N, model: DefaultTreeModel) {
|
||||
val children = TreeUtil.childrenToArray(fromNode)
|
||||
val children = TreeUtil.listChildren(fromNode)
|
||||
moveChildren(children, toNode, model)
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class ModuleGroupingTreeHelper<N: MutableTreeNode> private constructor(
|
||||
val nodeAsGroup = nodeData[node]?.group
|
||||
removeNode(node)
|
||||
if (nodeAsGroup != null) {
|
||||
val childrenToKeep = TreeUtil.childrenToArray(node).filter { it in nodeData }
|
||||
val childrenToKeep = TreeUtil.listChildren(node).filter { it in nodeData }
|
||||
if (childrenToKeep.isNotEmpty()) {
|
||||
val newGroupNode = getOrCreateNodeForModuleGroup(nodeAsGroup, rootNode, model, false)
|
||||
moveChildren(childrenToKeep, newGroupNode, model)
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ public class PackageDependenciesNode extends DefaultMutableTreeNode implements N
|
||||
|
||||
public void sortChildren() {
|
||||
if (isSorted()) return;
|
||||
final List children = TreeUtil.childrenToArray(this);
|
||||
final List children = TreeUtil.listChildren(this);
|
||||
Collections.sort(children, new DependencyNodeComparator());
|
||||
removeAllChildren();
|
||||
TreeUtil.addChildrenTo(this, children);
|
||||
|
||||
@@ -1671,7 +1671,7 @@ public class AbstractTreeUi {
|
||||
final boolean forceUpdate,
|
||||
final boolean wasExpaned,
|
||||
@Nullable final LoadedChildren preloaded) {
|
||||
final List<TreeNode> childNodes = TreeUtil.childrenToArray(node);
|
||||
final List<TreeNode> childNodes = TreeUtil.listChildren(node);
|
||||
return maybeYeild(new AsyncRunnable() {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -3509,7 +3509,7 @@ public class AbstractTreeUi {
|
||||
sortChildren(parentNode, toInsert, false, true);
|
||||
final List<TreeNode> all = new ArrayList<>(toInsert.size() + parentNode.getChildCount());
|
||||
all.addAll(toInsert);
|
||||
all.addAll(TreeUtil.childrenToArray(parentNode));
|
||||
all.addAll(TreeUtil.listChildren(parentNode));
|
||||
|
||||
if (!toInsert.isEmpty()) {
|
||||
sortChildren(parentNode, all, true, true);
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
package com.intellij.ide.util.treeView;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TreeBuilderUtil {
|
||||
}
|
||||
|
||||
private static void _storePaths(JTree tree, DefaultMutableTreeNode root, List<Object> pathsToExpand, List<Object> selectionPaths, boolean storeElementsOnly) {
|
||||
ArrayList childNodes = TreeUtil.childrenToArray(root);
|
||||
List<TreeNode> childNodes = TreeUtil.listChildren(root);
|
||||
for (final Object childNode1 : childNodes) {
|
||||
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)childNode1;
|
||||
TreePath path = new TreePath(childNode.getPath());
|
||||
|
||||
@@ -345,7 +345,7 @@ public final class TreeUtil {
|
||||
|
||||
public static <T extends MutableTreeNode> void sortChildren(@NotNull T node, @Nullable Comparator<? super T> comparator) {
|
||||
//noinspection unchecked
|
||||
final List<T> children = (List)childrenToArray(node);
|
||||
final List<T> children = (List)listChildren(node);
|
||||
Collections.sort(children, comparator);
|
||||
for (int i = node.getChildCount() - 1; i >= 0; i--) {
|
||||
node.remove(i);
|
||||
@@ -751,11 +751,19 @@ public final class TreeUtil {
|
||||
selectNode(tree, treeNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #listChildren(TreeNode)} instead
|
||||
*/
|
||||
@NotNull
|
||||
public static ArrayList<TreeNode> childrenToArray(@NotNull final TreeNode node) {
|
||||
public static ArrayList<TreeNode> childrenToArray(@NotNull TreeNode node) {
|
||||
return (ArrayList<TreeNode>)listChildren(node);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<TreeNode> listChildren(@NotNull final TreeNode node) {
|
||||
//ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final int size = node.getChildCount();
|
||||
final ArrayList<TreeNode> result = new ArrayList<>(size);
|
||||
int size = node.getChildCount();
|
||||
ArrayList<TreeNode> result = new ArrayList<>(size);
|
||||
for(int i = 0; i < size; i++){
|
||||
TreeNode child = node.getChildAt(i);
|
||||
LOG.assertTrue(child != null);
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class GradleProjectCompositeSelectorDialog extends DialogWrapper {
|
||||
final Object root = treeModel.getRoot();
|
||||
if (!(root instanceof CheckedTreeNode)) return;
|
||||
|
||||
for (TreeNode node : TreeUtil.childrenToArray((CheckedTreeNode)root)) {
|
||||
for (TreeNode node : TreeUtil.listChildren((CheckedTreeNode)root)) {
|
||||
if (!(node instanceof CheckedTreeNode)) continue;
|
||||
consumer.consume(((CheckedTreeNode)node));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user