mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure pushers are run before initial indexing, don't rely on chance
This commit is contained in:
+18
-17
@@ -79,10 +79,6 @@ public class PushedFilePropertiesUpdater {
|
||||
StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long l = System.currentTimeMillis();
|
||||
pushAll(myPushers);
|
||||
LOG.info("File properties pushed in " + (System.currentTimeMillis() - l) + " ms");
|
||||
|
||||
final MessageBusConnection connection = bus.connect();
|
||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
@@ -121,23 +117,28 @@ public class PushedFilePropertiesUpdater {
|
||||
doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
|
||||
}
|
||||
}));
|
||||
for (final FilePropertyPusher pusher : myPushers) {
|
||||
pusher.initExtra(project, bus, new FilePropertyPusher.Engine() {
|
||||
@Override
|
||||
public void pushAll() {
|
||||
PushedFilePropertiesUpdater.this.pushAll(pusher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushRecursively(VirtualFile file, Project project) {
|
||||
PushedFilePropertiesUpdater.this.schedulePushRecursively(file, pusher);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void initializeProperties() {
|
||||
pushAll(myPushers);
|
||||
|
||||
for (final FilePropertyPusher pusher : myPushers) {
|
||||
pusher.initExtra(myProject, myProject.getMessageBus(), new FilePropertyPusher.Engine() {
|
||||
@Override
|
||||
public void pushAll() {
|
||||
PushedFilePropertiesUpdater.this.pushAll(pusher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushRecursively(VirtualFile file, Project project) {
|
||||
PushedFilePropertiesUpdater.this.schedulePushRecursively(file, pusher);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void schedulePushRecursively(final VirtualFile dir, final FilePropertyPusher... pushers) {
|
||||
if (pushers.length == 0) return;
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.roots.ContentIterator;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.openapi.roots.impl.ProjectRootManagerComponent;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -72,6 +73,8 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple
|
||||
startupManager.registerPreStartupActivity(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PushedFilePropertiesUpdater.getInstance(project).initializeProperties();
|
||||
|
||||
// dumb mode should start before post-startup activities
|
||||
// only when queueTask is called from UI thread, we can guarantee that
|
||||
// when the method returns, the application has entered dumb mode
|
||||
|
||||
Reference in New Issue
Block a user