Search in sources :

Example 1 with StartupManagerEx

use of com.intellij.ide.startup.StartupManagerEx in project intellij-community by JetBrains.

the class MavenProjectsManager method initComponent.

@Override
public void initComponent() {
    if (!isNormalProject())
        return;
    StartupManagerEx startupManager = StartupManagerEx.getInstanceEx(myProject);
    startupManager.registerStartupActivity(() -> {
        boolean wasMavenized = !myState.originalFiles.isEmpty();
        if (!wasMavenized)
            return;
        initMavenized();
    });
    startupManager.registerPostStartupActivity(() -> {
        if (!isMavenizedProject()) {
            showNotificationOrphanMavenProject(myProject);
        }
        CompilerManager.getInstance(myProject).addBeforeTask(new CompileTask() {

            @Override
            public boolean execute(CompileContext context) {
                AccessToken token = ReadAction.start();
                try {
                    new MavenResourceCompilerConfigurationGenerator(myProject, myProjectsTree).generateBuildConfiguration(context.isRebuild());
                } finally {
                    token.finish();
                }
                return true;
            }
        });
    });
}
Also used : CompileTask(com.intellij.openapi.compiler.CompileTask) StartupManagerEx(com.intellij.ide.startup.StartupManagerEx) AccessToken(com.intellij.openapi.application.AccessToken) CompileContext(com.intellij.openapi.compiler.CompileContext)

Aggregations

StartupManagerEx (com.intellij.ide.startup.StartupManagerEx)1 AccessToken (com.intellij.openapi.application.AccessToken)1 CompileContext (com.intellij.openapi.compiler.CompileContext)1 CompileTask (com.intellij.openapi.compiler.CompileTask)1