本文整理汇总了Java中com.intellij.openapi.startup.StartupManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java StartupManager.getInstance方法的具体用法?Java StartupManager.getInstance怎么用?Java StartupManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.startup.StartupManager
的用法示例。
在下文中一共展示了StartupManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public void projectOpened() {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerStartupActivity(new Runnable() {
@Override
public void run() {
if (myVcsManager.needAutodetectMappings()) {
autoDetectVcsMappings(true);
}
myVcsManager.updateActiveVcss();
}
});
manager.registerPostStartupActivity(new Runnable() {
@Override
public void run() {
if (myMessageBus != null) {
myConnection = myMessageBus.connect();
final MyModulesListener listener = new MyModulesListener();
myConnection.subscribe(ProjectTopics.MODULES, listener);
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, listener);
}
}
});
}
示例2: UpdateRequestsQueue
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
public UpdateRequestsQueue(final Project project, final AtomicReference<ScheduledExecutorService> executor, final Runnable delegate) {
myProject = project;
myExecutor = executor;
myTrackHeavyLatch = Boolean.parseBoolean(System.getProperty(ourHeavyLatchOptimization));
myDelegate = delegate;
myPlVcsManager = ProjectLevelVcsManager.getInstance(myProject);
myStartupManager = StartupManager.getInstance(myProject);
myLock = new Object();
myWaitingUpdateCompletionQueue = new ArrayList<Runnable>();
// not initialized
myStarted = false;
myStopped = false;
myIsStoppedGetter = new Getter<Boolean>() {
@Override
public Boolean get() {
return isStopped();
}
};
}
示例3: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
public void projectOpened() {
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerPostStartupActivity(new DumbAwareRunnable() {
public void run() {
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
if (toolWindowManager != null) { // Can be null in tests
ToolWindow toolWindow =
toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true);
myContentManager = toolWindow.getContentManager();
toolWindow.setIcon(AllIcons.Toolwindows.VcsSmallTab);
toolWindow.installWatcher(myContentManager);
} else {
myContentManager = ContentFactory.SERVICE.getInstance().createContentManager(true, myProject);
}
}
});
}
示例4: getProject
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
private Project getProject() {
String path = "R:/_github.com/consulo/mssdw";
try {
final Project project;
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
Project[] openProjects = projectManager.getOpenProjects();
if (openProjects.length > 0) {
project = openProjects[0];
}
else {
project = projectManager.loadProject(path);
projectManager.openTestProject(project);
final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(project);
startupManager.runStartupActivities();
startupManager.startCacheUpdate();
}
return project;
}
catch (Exception e) {
e.getMessage();
}
return null;
}
示例5: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public void projectOpened() {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerStartupActivity(new Runnable() {
@Override
public void run() {
if (myVcsManager.needAutodetectMappings()) {
autoDetectVcsMappings(true);
}
myVcsManager.updateActiveVcss();
}
});
manager.registerPostStartupActivity(new Runnable() {
@Override
public void run() {
if (myMessageBus != null) {
myConnection = myMessageBus.connect();
final MyModulesListener listener = new MyModulesListener();
myConnection.subscribe(ProjectTopics.MODULES, listener);
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, listener);
}
}
});
}
示例6: UpdateRequestsQueue
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
public UpdateRequestsQueue(final Project project, @Nonnull ChangeListManagerImpl.Scheduler scheduler, final Runnable delegate) {
myProject = project;
myScheduler = scheduler;
myTrackHeavyLatch = Boolean.parseBoolean(System.getProperty(ourHeavyLatchOptimization));
myDelegate = delegate;
myPlVcsManager = ProjectLevelVcsManager.getInstance(myProject);
myStartupManager = StartupManager.getInstance(myProject);
myLock = new Object();
myWaitingUpdateCompletionQueue = new ArrayList<>();
// not initialized
myStarted = false;
myStopped = false;
myIsStoppedGetter = new Getter<Boolean>() {
@Override
public Boolean get() {
return isStopped();
}
};
}
示例7: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public void projectOpened() {
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerPostStartupActivity(new DumbAwareRunnable() {
@Override
public void run() {
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
if (toolWindowManager != null) { // Can be null in tests
if (!Registry.is("vcs.merge.toolwindows")) {
ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true);
myContentManager = toolWindow.getContentManager();
toolWindow.setIcon(AllIcons.Toolwindows.VcsSmallTab);
toolWindow.installWatcher(myContentManager);
}
}
else {
myContentManager = ContentFactory.SERVICE.getInstance().createContentManager(true, myProject);
}
}
});
addInitializationRequest(VcsInitObject.AFTER_COMMON, new Runnable() {
@Override
public void run() {
if (!ApplicationManager.getApplication().isUnitTestMode()) {
VcsRootChecker[] checkers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
if (checkers.length != 0) {
VcsRootScanner.start(myProject, checkers);
}
}
}
});
}
示例8: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
public void projectOpened() {
StartupManager startupManager = StartupManager.getInstance(myProject);
if (startupManager == null) {
return;
}
startupManager.registerPostStartupActivity(new Runnable() {
@Override
public void run() {
updateChangesContent();
}
});
}
示例9: simulateProjectOpen
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
protected void simulateProjectOpen() {
ModuleManagerImpl mm = (ModuleManagerImpl)ModuleManager.getInstance(myProject);
StartupManagerImpl sm = (StartupManagerImpl)StartupManager.getInstance(myProject);
mm.projectOpened();
setUpJdk();
sm.runStartupActivities();
sm.startCacheUpdate();
// extra init for libraries
sm.runPostStartupActivities();
}
示例10: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public void projectOpened() {
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerPostStartupActivity(new DumbAwareRunnable() {
public void run() {
registerNuxeoShellToolWindow();
}
});
}
示例11: simulateProjectOpen
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
protected void simulateProjectOpen() {
ModuleManagerImpl mm = (ModuleManagerImpl)ModuleManager.getInstance(myProject);
StartupManagerImpl sm = (StartupManagerImpl)StartupManager.getInstance(myProject);
mm.projectOpened();
sm.runStartupActivities();
sm.startCacheUpdate();
// extra init for libraries
sm.runPostStartupActivities();
}
示例12: projectOpened
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public void projectOpened() {
StartupManager startupManager = StartupManager.getInstance(myProject);
if (startupManager == null) {
return; // upsource
}
startupManager.registerPostStartupActivity(new DumbAwareRunnable() {
@Override
public void run() {
final Set<Profile> profiles = new HashSet<Profile>();
profiles.add(getProjectProfileImpl());
profiles.addAll(getProfiles());
profiles.addAll(InspectionProfileManager.getInstance().getProfiles());
final Application app = ApplicationManager.getApplication();
Runnable initInspectionProfilesRunnable = new Runnable() {
@Override
public void run() {
for (Profile profile : profiles) {
initProfileWrapper(profile);
}
fireProfilesInitialized();
}
};
if (app.isUnitTestMode() || app.isHeadlessEnvironment()) {
initInspectionProfilesRunnable.run();
UIUtil.dispatchAllInvocationEvents(); //do not restart daemon in the middle of the test
}
else {
app.executeOnPooledThread(initInspectionProfilesRunnable);
}
myScopeListener = new NamedScopesHolder.ScopeListener() {
@Override
public void scopesChanged() {
for (Profile profile : getProfiles()) {
((InspectionProfile)profile).scopesChanged();
}
}
};
myHolder.addScopeListener(myScopeListener);
myLocalScopesHolder.addScopeListener(myScopeListener);
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
myHolder.removeScopeListener(myScopeListener);
myLocalScopesHolder.removeScopeListener(myScopeListener);
}
});
}
});
}
示例13: runStartupActivities
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
protected void runStartupActivities() {
final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(myProject);
startupManager.runStartupActivities();
startupManager.startCacheUpdate();
startupManager.runPostStartupActivities();
}
示例14: openProject
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
@Override
public boolean openProject(@NotNull final Project project) {
if (isLight(project)) {
((ProjectImpl)project).setTemporarilyDisposed(false);
boolean isInitialized = StartupManagerEx.getInstanceEx(project).startupActivityPassed();
if (isInitialized) {
addToOpened(project);
// events already fired
return true;
}
}
if (!addToOpened(project)) {
return false;
}
fireProjectOpened(project);
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
@Override
public void run() {
DumbService.getInstance(project).queueTask(new DumbModeTask() {
@Override
public void performInDumbMode(@NotNull ProgressIndicator indicator) {
waitForFileWatcher(indicator);
}
@Override
public String toString() {
return "wait for file watcher";
}
});
}
});
final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(project);
boolean ok = myProgressManager.runProcessWithProgressSynchronously(new Runnable() {
@Override
public void run() {
startupManager.runStartupActivities();
// dumb mode should start before post-startup activities
// only when startCacheUpdate is called from UI thread, we can guarantee that
// when the method returns, the application has entered dumb mode
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
startupManager.startCacheUpdate();
}
});
startupManager.runPostStartupActivitiesFromExtensions();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (!project.isDisposed()) {
startupManager.runPostStartupActivities();
Application application = ApplicationManager.getApplication();
if (!(application.isHeadlessEnvironment() || application.isUnitTestMode())) {
StorageUtil.checkUnknownMacros(project, true);
}
}
}
});
}
}, ProjectBundle.message("project.load.progress"), canCancelProjectLoading(), project);
if (!ok) {
closeProject(project, false, false, true);
notifyProjectOpenFailed();
return false;
}
return true;
}
示例15: ContentResourceChangeListener
import com.intellij.openapi.startup.StartupManager; //导入方法依赖的package包/类
public ContentResourceChangeListener(@NotNull Project project) {
super(project);
final ServerConnectionManager serverConnectionManager = ComponentProvider.getComponent(project, ServerConnectionManager.class);
pluginConfiguration = ComponentProvider.getComponent(project, AEMPluginConfiguration.class);
this.serverConnectionManager = serverConnectionManager;
this.project = project;
// Register a Startup Manager to check the project if it is default after the project is initialized
StartupManager startupManager = StartupManager.getInstance(project);
startupManager.runWhenProjectIsInitialized(
new Runnable() {
@Override
public void run() {
SlingServerTreeManager slingServerTreeManager = ComponentProvider.getComponent(myProject, SlingServerTreeManager.class);
if(slingServerTreeManager != null) {
// At the end of the Tool Window is created we run the Check if a project is marked as Default
Object modelRoot = slingServerTreeManager.getTree().getModel().getRoot();
if (modelRoot instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) modelRoot;
Enumeration e = rootNode.children();
while (e.hasMoreElements()) {
TreeNode child = (TreeNode) e.nextElement();
if (child instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) child;
Object target = childNode.getUserObject();
if (target instanceof SlingServerNodeDescriptor) {
ActionManager actionManager = ActionManager.getInstance();
SlingServerNodeDescriptor descriptor = (SlingServerNodeDescriptor) target;
switch (descriptor.getTarget().getDefaultMode()) {
case run:
slingServerTreeManager.getTree().setSelectionPath(new TreePath(childNode.getPath()));
StartRunConnectionAction runAction = (StartRunConnectionAction) actionManager.getAction("AEM.Check.Action");
if (runAction != null) {
runAction.doRun(myProject, SimpleDataContext.EMPTY_CONTEXT, new ProgressHandlerImpl("Connection Change Listener Check").setForceAsynchronous(false));
}
break;
case debug:
slingServerTreeManager.getTree().setSelectionPath(new TreePath(childNode.getPath()));
StartDebugConnectionAction debugAction = (StartDebugConnectionAction) actionManager.getAction("AEM.Start.Debug.Action");
if (debugAction != null) {
debugAction.doDebug(myProject, serverConnectionManager);
}
break;
}
}
}
}
}
}
}
}
);
}