mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure that project view refreshed before searching a node
This commit is contained in:
+2
-2
@@ -51,7 +51,7 @@ class AsyncProjectViewSupport {
|
||||
@NotNull JTree tree,
|
||||
@NotNull AbstractTreeStructure structure,
|
||||
@NotNull Comparator<NodeDescriptor> comparator) {
|
||||
myStructureTreeModel = new StructureTreeModel(structure, comparator);
|
||||
myStructureTreeModel = new StructureTreeModel<>(structure, comparator);
|
||||
myAsyncTreeModel = new AsyncTreeModel(myStructureTreeModel, parent);
|
||||
myAsyncTreeModel.setRootImmediately(myStructureTreeModel.getRootImmediately());
|
||||
myNodeUpdater = new ProjectFileNodeUpdater(project, myStructureTreeModel.getInvoker()) {
|
||||
@@ -165,8 +165,8 @@ class AsyncProjectViewSupport {
|
||||
SmartList<TreePath> pathsToSelect = new SmartList<>();
|
||||
TreeVisitor visitor = AbstractProjectViewPane.createVisitor(element, file, pathsToSelect);
|
||||
if (visitor != null) {
|
||||
//noinspection CodeBlock2Expr
|
||||
expand(tree, promise -> {
|
||||
myNodeUpdater.updateImmediately();
|
||||
myAsyncTreeModel
|
||||
.accept(visitor)
|
||||
.onProcessed(path -> {
|
||||
|
||||
@@ -148,7 +148,7 @@ public abstract class ProjectFileNodeUpdater {
|
||||
* Usually, it is needed to find an added file in a tree right after adding.
|
||||
*/
|
||||
public void updateImmediately() {
|
||||
invoker.runOrInvokeLater(this::onInvokerThread);
|
||||
invoker.runOrInvokeLater(() -> onInvokerThread(true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,11 +180,11 @@ public abstract class ProjectFileNodeUpdater {
|
||||
}
|
||||
if (start) {
|
||||
LOG.debug("start collecting files to update @ ", invoker);
|
||||
invoker.invokeLater(this::onInvokerThread, getUpdatingDelay());
|
||||
invoker.invokeLater(() -> onInvokerThread(false), getUpdatingDelay());
|
||||
}
|
||||
}
|
||||
|
||||
private void onInvokerThread() {
|
||||
private void onInvokerThread(boolean now) {
|
||||
Set<VirtualFile> files;
|
||||
long startedAt;
|
||||
boolean fromRoot;
|
||||
@@ -201,7 +201,7 @@ public abstract class ProjectFileNodeUpdater {
|
||||
root = false;
|
||||
reference.set(null);
|
||||
}
|
||||
else if (size == files.size()) {
|
||||
else if (now || size == files.size()) {
|
||||
reference.set(null);
|
||||
}
|
||||
else {
|
||||
@@ -210,7 +210,7 @@ public abstract class ProjectFileNodeUpdater {
|
||||
}
|
||||
if (restart) {
|
||||
LOG.debug("continue collecting files to update @ ", invoker);
|
||||
invoker.invokeLater(this::onInvokerThread, getUpdatingDelay());
|
||||
invoker.invokeLater(() -> onInvokerThread(false), getUpdatingDelay());
|
||||
}
|
||||
else {
|
||||
LOG.debug("spent ", System.currentTimeMillis() - startedAt, "ms to collect ", size, " files to update @ ", invoker);
|
||||
|
||||
Reference in New Issue
Block a user