use of com.intellij.openapi.project.impl.ProjectLifecycleListener in project intellij-community by JetBrains.
the class StartupManagerImpl method scheduleInitialVfsRefresh.
public void scheduleInitialVfsRefresh() {
GuiUtils.invokeLaterIfNeeded(() -> {
if (myProject.isDisposed() || myInitialRefreshScheduled)
return;
myInitialRefreshScheduled = true;
markContentRootsForRefresh();
Application app = ApplicationManager.getApplication();
if (!app.isCommandLine()) {
final long sessionId = VirtualFileManager.getInstance().asyncRefresh(null);
final MessageBusConnection connection = app.getMessageBus().connect();
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void afterProjectClosed(@NotNull Project project) {
if (project != myProject)
return;
RefreshQueue.getInstance().cancelSession(sessionId);
connection.disconnect();
}
});
} else {
VirtualFileManager.getInstance().syncRefresh();
}
}, ModalityState.defaultModalityState());
}
Aggregations