当前位置: 首页>>代码示例>>Java>>正文


Java ProjectLifecycleListener类代码示例

本文整理汇总了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();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:StartupManagerImpl.java

示例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));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:EditorFactoryImpl.java

示例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());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:StartupManagerImpl.java

示例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();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:IconDeferrerImpl.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:StartupManagerImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:IconDeferrerImpl.java


注:本文中的com.intellij.openapi.project.impl.ProjectLifecycleListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。