本文整理汇总了Java中com.intellij.openapi.project.impl.ProjectLifecycleListener类的典型用法代码示例。如果您正苦于以下问题:Java ProjectLifecycleListener类的具体用法?Java ProjectLifecycleListener怎么用?Java ProjectLifecycleListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectLifecycleListener类属于com.intellij.openapi.project.impl包,在下文中一共展示了ProjectLifecycleListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scheduleInitialVfsRefresh
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public void scheduleInitialVfsRefresh() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
markContentRootsForRefresh();
Application app = ApplicationManager.getApplication();
if (!app.isHeadlessEnvironment()) {
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();
}
}
});
}
示例2: EditorFactoryImpl
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public EditorFactoryImpl(EditorActionManager editorActionManager) {
Application application = ApplicationManager.getApplication();
MessageBus bus = application.getMessageBus();
MessageBusConnection connect = bus.connect();
connect.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void beforeProjectLoaded(@Nonnull final Project project) {
// validate all editors are disposed after fireProjectClosed() was called, because it's the place where editor should be released
Disposer.register(project, () -> {
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
final boolean isLastProjectClosed = openProjects.length == 0;
validateEditorsAreReleased(project, isLastProjectClosed);
});
}
});
ApplicationManager.getApplication().getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
refreshAllEditors();
}
});
TypedAction typedAction = editorActionManager.getTypedAction();
TypedActionHandler originalHandler = typedAction.getRawHandler();
typedAction.setupRawHandler(new MyTypedHandler(originalHandler));
}
示例3: scheduleInitialVfsRefresh
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public void scheduleInitialVfsRefresh() {
GuiUtils.invokeLaterIfNeeded(() -> {
if (myProject.isDisposed() || myInitialRefreshScheduled) return;
myInitialRefreshScheduled = true;
((ProjectRootManagerImpl)ProjectRootManager.getInstance(myProject)).markRootsForRefresh();
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(@Nonnull Project project) {
if (project != myProject) return;
RefreshQueue.getInstance().cancelSession(sessionId);
connection.disconnect();
}
});
}
else {
VirtualFileManager.getInstance().syncRefresh();
}
}, ModalityState.defaultModalityState());
}
示例4: IconDeferrerImpl
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public IconDeferrerImpl(MessageBus bus) {
final MessageBusConnection connection = bus.connect();
connection.subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() {
@Override
public void modificationCountChanged() {
clear();
}
});
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
@Override
public void afterProjectClosed(@NotNull Project project) {
clear();
}
});
}
示例5: runPostStartupActivities
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public synchronized void runPostStartupActivities() {
final Application app = ApplicationManager.getApplication();
if (myPostStartupActivitiesPassed) return;
runActivities(myDumbAwarePostStartupActivities);
DumbService.getInstance(myProject).runWhenSmart(new Runnable() {
public void run() {
synchronized (StartupManagerImpl.this) {
app.assertIsDispatchThread();
if (myProject.isDisposed()) return;
runActivities(myDumbAwarePostStartupActivities); // they can register activities while in the dumb mode
runActivities(myNotDumbAwarePostStartupActivities);
myPostStartupActivitiesPassed = true;
}
}
});
if (!app.isUnitTestMode() && !myProject.isDisposed()) {
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();
}
}
Registry.get("ide.firstStartup").setValue(false);
}
示例6: IconDeferrerImpl
import com.intellij.openapi.project.impl.ProjectLifecycleListener; //导入依赖的package包/类
public IconDeferrerImpl(MessageBus bus) {
final MessageBusConnection connection = bus.connect();
connection.subscribe(PsiModificationTracker.TOPIC, this::clear);
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void afterProjectClosed(@Nonnull Project project) {
clear();
}
});
LowMemoryWatcher.register(this::clear, connection);
}