Example usage for com.intellij.openapi.project.impl ProjectLifecycleListener TOPIC

List of usage examples for com.intellij.openapi.project.impl ProjectLifecycleListener TOPIC

Introduction

In this page you can find the example usage for com.intellij.openapi.project.impl ProjectLifecycleListener TOPIC.

Prototype

Topic TOPIC

To view the source code for com.intellij.openapi.project.impl ProjectLifecycleListener TOPIC.

Click Source Link

Usage

From source file:com.android.tools.idea.stats.AndroidStudioUsageTracker.java

License:Apache License

private static void subscribeToEvents() {
    Application app = ApplicationManager.getApplication();
    MessageBusConnection connection = app.getMessageBus().connect();
    connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleTracker());
}

From source file:com.intellij.ide.startup.impl.StartupManagerImpl.java

License:Apache License

public void scheduleInitialVfsRefresh() {
    UIUtil.invokeLaterIfNeeded(new Runnable() {
        @Override//from  ww  w.j a  va 2  s . c om
        public void run() {
            if (myProject.isDisposed())
                return;

            Application app = ApplicationManager.getApplication();
            if (!app.isHeadlessEnvironment()) {
                checkProjectRoots();
                final long sessionId = VirtualFileManager.getInstance().asyncRefresh(null);
                final MessageBusConnection connection = app.getMessageBus().connect();
                connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
                    @Override
                    public void afterProjectClosed(@NotNull Project project) {
                        RefreshQueue.getInstance().cancelSession(sessionId);
                        connection.disconnect();
                    }
                });
            } else {
                VirtualFileManager.getInstance().syncRefresh();
            }
        }
    });
}

From source file:com.intellij.ui.IconDeferrerImpl.java

License:Apache License

public IconDeferrerImpl(MessageBus bus) {
    final MessageBusConnection connection = bus.connect();
    connection.subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() {
        @Override/*from  ww  w  .j ava2 s  . com*/
        public void modificationCountChanged() {
            clear();
        }
    });
    connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
        @Override
        public void afterProjectClosed(@NotNull Project project) {
            clear();
        }
    });
}