Search in sources :

Example 1 with StartupActivity

use of com.intellij.openapi.startup.StartupActivity in project intellij-community by JetBrains.

the class ExternalSystemStartupActivity method runActivity.

@Override
public void runActivity(@NotNull final Project project) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return;
    }
    Runnable task = () -> {
        for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemApiUtil.getAllManagers()) {
            if (manager instanceof StartupActivity) {
                ((StartupActivity) manager).runActivity(project);
            }
        }
        if (project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) != Boolean.TRUE) {
            for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
                final boolean isNewProject = project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE;
                if (isNewProject) {
                    ExternalSystemUtil.refreshProjects(new ImportSpecBuilder(project, manager.getSystemId()).createDirectoriesForEmptyContentRoots());
                }
            }
        }
        ExternalToolWindowManager.handle(project);
        ExternalSystemVcsRegistrar.handle(project);
        ProjectRenameAware.beAware(project);
    };
    ExternalProjectsManager.getInstance(project).init();
    DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(task, project));
}
Also used : StartupActivity(com.intellij.openapi.startup.StartupActivity) ExternalSystemManager(com.intellij.openapi.externalSystem.ExternalSystemManager) DisposeAwareRunnable(com.intellij.util.DisposeAwareRunnable) ImportSpecBuilder(com.intellij.openapi.externalSystem.importing.ImportSpecBuilder)

Example 2 with StartupActivity

use of com.intellij.openapi.startup.StartupActivity in project intellij by bazelbuild.

the class CidrSymbolBuilderSuppressor method addFiltersToStartupActivities.

private void addFiltersToStartupActivities() {
    ExtensionPoint<StartupActivity> ep = Extensions.getRootArea().getExtensionPoint(StartupActivity.POST_STARTUP_ACTIVITY);
    for (Class<? extends StartupActivity> startupActivity : CidrStartupActivitiesToSuppress.STARTUP_ACTIVITIES_TO_SUPPRESS) {
        StartupActivity startupActivityInstance = StartupActivity.POST_STARTUP_ACTIVITY.findExtension(startupActivity);
        Preconditions.checkNotNull(startupActivityInstance);
        StartupActivity replacementStartupActivity = new BlazeSuppressStartupActivity(startupActivityInstance);
        ep.registerExtension(replacementStartupActivity, LoadingOrder.before(startupActivity.getSimpleName()));
        ep.unregisterExtension(startupActivityInstance);
    }
}
Also used : StartupActivity(com.intellij.openapi.startup.StartupActivity)

Aggregations

StartupActivity (com.intellij.openapi.startup.StartupActivity)2 ExternalSystemManager (com.intellij.openapi.externalSystem.ExternalSystemManager)1 ImportSpecBuilder (com.intellij.openapi.externalSystem.importing.ImportSpecBuilder)1 DisposeAwareRunnable (com.intellij.util.DisposeAwareRunnable)1