mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Select found paths on EDT
GitOrigin-RevId: 4053b0cbae8a2a221ba29666e1c1a33b20c50768
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d0e7f139c8
commit
736053ccc1
+21
-21
@@ -175,32 +175,32 @@ public class AsyncProjectViewSupport {
|
||||
//noinspection CodeBlock2Expr
|
||||
myNodeUpdater.updateImmediately(() -> expand(tree, promise -> {
|
||||
promise.onSuccess(o -> callback.setDone());
|
||||
myAsyncTreeModel
|
||||
.accept(visitor)
|
||||
.onProcessed(path -> {
|
||||
if (selectPaths(tree, pathsToSelect, visitor) ||
|
||||
element == null ||
|
||||
file == null ||
|
||||
Registry.is("async.project.view.support.extra.select.disabled")) {
|
||||
acceptOnEDT(visitor, () -> {
|
||||
if (selectPaths(tree, pathsToSelect, visitor) ||
|
||||
element == null ||
|
||||
file == null ||
|
||||
Registry.is("async.project.view.support.extra.select.disabled")) {
|
||||
promise.setResult(null);
|
||||
}
|
||||
else {
|
||||
// try to search the specified file instead of element,
|
||||
// because Kotlin files cannot represent containing functions
|
||||
pathsToSelect.clear();
|
||||
TreeVisitor fileVisitor = AbstractProjectViewPane.createVisitor(null, file, pathsToSelect);
|
||||
acceptOnEDT(fileVisitor, () -> {
|
||||
selectPaths(tree, pathsToSelect, fileVisitor);
|
||||
promise.setResult(null);
|
||||
}
|
||||
else {
|
||||
// try to search the specified file instead of element,
|
||||
// because Kotlin files cannot represent containing functions
|
||||
pathsToSelect.clear();
|
||||
TreeVisitor fileVisitor = AbstractProjectViewPane.createVisitor(null, file, pathsToSelect);
|
||||
myAsyncTreeModel
|
||||
.accept(fileVisitor)
|
||||
.onProcessed(path2 -> {
|
||||
selectPaths(tree, pathsToSelect, fileVisitor);
|
||||
promise.setResult(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
return callback;
|
||||
}
|
||||
|
||||
private void acceptOnEDT(@NotNull TreeVisitor visitor, @NotNull Runnable task) {
|
||||
myAsyncTreeModel.accept(visitor).onProcessed(path -> myAsyncTreeModel.onValidThread(task));
|
||||
}
|
||||
|
||||
private static boolean selectPaths(@NotNull JTree tree, @NotNull List<TreePath> paths, @NotNull TreeVisitor visitor) {
|
||||
if (paths.isEmpty()) return false;
|
||||
if (paths.size() > 1) {
|
||||
|
||||
Reference in New Issue
Block a user