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


Java StartupManager类代码示例

本文整理汇总了Java中com.intellij.openapi.startup.StartupManager的典型用法代码示例。如果您正苦于以下问题:Java StartupManager类的具体用法?Java StartupManager怎么用?Java StartupManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StartupManager类属于com.intellij.openapi.startup包,在下文中一共展示了StartupManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: projectOpened

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void projectOpened(final Project project) {
    StartupManager.getInstance(project).registerPostStartupActivity((DumbAwareRunnable) () -> {
        if (project.isDisposed()) {
            return;
        }
        if (isOldHybrisProject(project)) {
            showNotification(project);
        }
        if (isDiscountTargetGroup()) {
            showDiscountOffer(project);
        }
        final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
        if (!commonIdeaService.isHybrisProject(project)) {
            return;
        }
        if (popupPermissionToSendStatistics(project)) {
            continueOpening(project);
        }
    });
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:HybrisProjectManagerListener.java

示例2: configureModule

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void configureModule(@NotNull Module module) {
  final Project project = module.getProject();
  StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> {
    final VirtualFile baseDir = project.getBaseDir();
    final String testHelper = EduNames.TEST_HELPER;
    if (baseDir.findChild(testHelper) != null) return;
    final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate("test_helper");
    final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir);
    if (projectDir == null) return;
    try {
      FileTemplateUtil.createFromTemplate(template, testHelper, null, projectDir);
    }
    catch (Exception exception) {
      LOG.error("Can't copy test_helper.py " + exception.getMessage());
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:PyEduPluginConfigurator.java

示例3: projectOpened

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void projectOpened() {
  ApplicationManager.getApplication().invokeLater((DumbAwareRunnable)() -> ApplicationManager.getApplication().runWriteAction(
    (DumbAwareRunnable)() -> {
      if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
        final String content = "<html>If you'd like to learn more about PyCharm Edu, " +
                               "click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
        final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION,
                                                           new NotificationListener.UrlOpeningListener(true));
        StartupManager.getInstance(myProject).registerPostStartupActivity(() -> Notifications.Bus.notify(notification));
        Balloon balloon = notification.getBalloon();
        if (balloon != null) {
          balloon.addListener(new JBPopupAdapter() {
            @Override
            public void onClosed(LightweightWindowEvent event) {
              notification.expire();
            }
          });
        }
        notification.whenExpired(() -> PropertiesComponent.getInstance().setValue(ourShowPopup, false, true));
      }
    }));
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:24,代码来源:PyStudyShowTutorial.java

示例4: updateTestHelper

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
private void updateTestHelper() {
  StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> ApplicationManager.getApplication().runWriteAction(() -> {
    final VirtualFile baseDir = myProject.getBaseDir();
    if (baseDir == null) {
      return;
    }
    final VirtualFile testHelper = baseDir.findChild(EduNames.TEST_HELPER);
    if (testHelper != null) {
      StudyUtils.deleteFile(testHelper);
    }
    final FileTemplate template =
      FileTemplateManager.getInstance(myProject).getInternalTemplate(FileUtil.getNameWithoutExtension(EduNames.TEST_HELPER));
    try {
      final PsiDirectory projectDir = PsiManager.getInstance(myProject).findDirectory(baseDir);
      if (projectDir != null) {
        FileTemplateUtil.createFromTemplate(template, EduNames.TEST_HELPER, null, projectDir);
      }
    }
    catch (Exception e) {
      LOG.warn("Failed to create new test helper");
    }
  }));
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:24,代码来源:StudyTaskManager.java

示例5: initFacet

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void initFacet() {
    StartupManager.getInstance(getModule().getProject()).runWhenProjectIsInitialized(new Runnable() {
        @Override
        public void run() {
            final Module module = getModule();
            XposedBridgeJarManager.getInstance(module).getOrCopyXposedJar();
            AndroidManifestManager.ensureManifestInfo(module);
            XposedBridgeDependencyManager.getInstance(module).ensureXposedBridgeDependency();
            IdeaUtils.syncGradleIfRequired(module, new Consumer<Boolean>() {
                @Override
                public void consume(Boolean success) {
                    if (success) {
                        XposedInitAssetManager.getInstance(module).syncDeclaredXposedHooks();
                    }
                }
            });
        }
    });
}
 
开发者ID:apsun,项目名称:XposedPlugin,代码行数:21,代码来源:XposedFacet.java

示例6: BreakpointManager

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
public BreakpointManager(@NotNull Project project, @NotNull StartupManager startupManager, @NotNull DebuggerManagerImpl debuggerManager) {
  myProject = project;
  myStartupManager = startupManager;
  debuggerManager.getContextManager().addListener(new DebuggerContextListener() {
    private DebuggerSession myPreviousSession;

    @Override
    public void changeEvent(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) {
      if (event == DebuggerSession.Event.ATTACHED) {
        for (XBreakpoint breakpoint : getXBreakpointManager().getAllBreakpoints()) {
          if (checkAndNotifyPossiblySlowBreakpoint(breakpoint)) break;
        }
      }
      if (newContext.getDebuggerSession() != myPreviousSession || event == DebuggerSession.Event.DETACHED) {
        updateBreakpointsUI();
        myPreviousSession = newContext.getDebuggerSession();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BreakpointManager.java

示例7: TestDiscoveryIndex

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
public TestDiscoveryIndex(Project project) {
  myProject = project;

  String path = TestDiscoveryExtension.baseTestDiscoveryPathForProject(myProject);

  if (new File(path).exists()) {
    StartupManager.getInstance(project).registerPostStartupActivity(new Runnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
          @Override
          public void run() {
            getHolder(); // proactively init with maybe io costly compact
          }
        });
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TestDiscoveryIndex.java

示例8: _do

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
public static void _do(@NotNull final ConfigurationError error, @NotNull final Project project,
                       @NotNull final PairProcessor<ConfigurationErrors, ConfigurationError> fun) {
  if (!project.isInitialized()) {
    StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
       @Override
       public void run() {
         fun.process(project.getMessageBus().syncPublisher(TOPIC), error);
       }
     });

    return;
  }

  final MessageBus bus = project.getMessageBus();
  if (EventQueue.isDispatchThread()) fun.process(bus.syncPublisher(TOPIC), error);
  else {
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        fun.process(bus.syncPublisher(TOPIC), error);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ConfigurationErrors.java

示例9: set

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
public static void set(@Nullable final String text, @Nullable final Project project, @Nullable final String requestor) {
  if (project != null) {
    if (project.isDisposed()) return;
    if (!project.isInitialized()) {
      StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
        public void run() {
          project.getMessageBus().syncPublisher(TOPIC).setInfo(text, requestor);
        }
      });
      return;
    }
  }

  final MessageBus bus = project == null ? ApplicationManager.getApplication().getMessageBus() : project.getMessageBus();
  bus.syncPublisher(TOPIC).setInfo(text, requestor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:StatusBar.java

示例10: loadState

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void loadState(ExternalDependenciesState state) {
  ArrayList<ProjectExternalDependency> oldDependencies = new ArrayList<ProjectExternalDependency>(myDependencies);
  myDependencies.clear();
  for (DependencyOnPluginState dependency : state.myDependencies) {
    myDependencies.add(new DependencyOnPlugin(dependency.myId, dependency.myMinVersion, dependency.myMaxVersion));
  }
  if (!oldDependencies.equals(myDependencies) && !myDependencies.isEmpty()) {
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        CheckRequiredPluginsActivity.runCheck(myProject);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalDependenciesManagerImpl.java

示例11: openFileFromCommandLine

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
private static void openFileFromCommandLine(final Project project, final VirtualFile virtualFile, final int line) {
  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
        public void run() {
          ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
            public void run() {
              if (!virtualFile.isDirectory()) {
                if (line > 0) {
                  new OpenFileDescriptor(project, virtualFile, line-1, 0).navigate(true);
                }
                else {
                  new OpenFileDescriptor(project, virtualFile).navigate(true);
                }
              }
            }
          });
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PlatformProjectOpenProcessor.java

示例12: setProjectName

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void setProjectName(@NotNull String projectName) {
  if (!projectName.equals(myName)) {
    myOldName = myName;
    myName = projectName;
    StartupManager.getInstance(this).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        if (isDisposed()) return;

        JFrame frame = WindowManager.getInstance().getFrame(ProjectImpl.this);
        String title = FrameTitleBuilder.getInstance().getProjectTitle(ProjectImpl.this);
        if (frame != null && title != null) {
          frame.setTitle(title);
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ProjectImpl.java

示例13: projectOpened

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@Override
public void projectOpened() {
  final ModuleRootListener rootListener = new ModuleRootAdapter() {
    public void rootsChanged(ModuleRootEvent event) {
      if (!myProject.isDisposed()) {
        checkToolWindowStatuses(myProject);
      }
    }
  };

  StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
    public void run() {
      if (!myProject.isDisposed()) {
        checkToolWindowStatuses(myProject);
        final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
        connection.subscribe(ProjectTopics.PROJECT_ROOTS, rootListener);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryDependentToolWindowManager.java

示例14: MessageViewImpl

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
public MessageViewImpl(final Project project, final StartupManager startupManager, final ToolWindowManager toolWindowManager) {
  final Runnable runnable = new Runnable() {
    public void run() {
      myToolWindow = toolWindowManager.registerToolWindow(ToolWindowId.MESSAGES_WINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
      myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowMessages);
      new ContentManagerWatcher(myToolWindow, getContentManager());
      for (Runnable postponedRunnable : myPostponedRunnables) {
        postponedRunnable.run();
      }
      myPostponedRunnables.clear();
    }
  };
  if (project.isInitialized()) {
    runnable.run();
  }
  else {
    startupManager.registerPostStartupActivity(new Runnable(){
      public void run() {
        runnable.run();
      }
    });
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MessageViewImpl.java

示例15: createAndCommitIfNeeded

import com.intellij.openapi.startup.StartupManager; //导入依赖的package包/类
@NotNull
public Module createAndCommitIfNeeded(@NotNull Project project, @Nullable ModifiableModuleModel model, boolean runFromProjectWizard)
  throws InvalidDataException, ConfigurationException, IOException, JDOMException, ModuleWithNameAlreadyExists {
  final ModifiableModuleModel moduleModel = model != null ? model : ModuleManager.getInstance(project).getModifiableModel();
  final Module module = createModule(moduleModel);
  if (model == null) moduleModel.commit();

  if (runFromProjectWizard) {
    StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            onModuleInitialized(module);
          }
        });
      }
    });
  }
  else {
    onModuleInitialized(module);
  }
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ModuleBuilder.java


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