Search in sources :

Example 1 with CompileTask

use of com.intellij.openapi.compiler.CompileTask in project intellij-community by JetBrains.

the class MavenTasksManager method initComponent.

@Override
public void initComponent() {
    if (!isNormalProject())
        return;
    if (isInitialized.getAndSet(true))
        return;
    CompilerManager compilerManager = CompilerManager.getInstance(myProject);
    class MyCompileTask implements CompileTask {

        private final boolean myBefore;

        MyCompileTask(boolean before) {
            myBefore = before;
        }

        @Override
        public boolean execute(CompileContext context) {
            return doExecute(myBefore, context);
        }
    }
    compilerManager.addBeforeTask(new MyCompileTask(true));
    compilerManager.addAfterTask(new MyCompileTask(false));
}
Also used : CompileTask(com.intellij.openapi.compiler.CompileTask) CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 2 with CompileTask

use of com.intellij.openapi.compiler.CompileTask 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)

Example 3 with CompileTask

use of com.intellij.openapi.compiler.CompileTask in project intellij-community by JetBrains.

the class ExternalSystemTaskActivator method init.

public void init() {
    CompilerManager compilerManager = CompilerManager.getInstance(myProject);
    class MyCompileTask implements CompileTask {

        private final boolean myBefore;

        MyCompileTask(boolean before) {
            myBefore = before;
        }

        @Override
        public boolean execute(CompileContext context) {
            return doExecuteCompileTasks(myBefore, context);
        }
    }
    compilerManager.addBeforeTask(new MyCompileTask(true));
    compilerManager.addAfterTask(new MyCompileTask(false));
    fireTasksChanged();
}
Also used : CompileTask(com.intellij.openapi.compiler.CompileTask) CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 4 with CompileTask

use of com.intellij.openapi.compiler.CompileTask in project intellij-community by JetBrains.

the class ClassFilesIndexFeaturesHolder method projectOpened.

@Override
public final void projectOpened() {
    for (final ClassFilesIndexFeature feature : ClassFilesIndexFeature.values()) {
        final RegistryValue registryValue = feature.getRegistryValue();
        registryValue.addListener(new RegistryValueListener.Adapter() {

            @Override
            public void afterValueChanged(final RegistryValue rawValue) {
                if (!rawValue.asBoolean() && myEnabledFeatures.containsKey(feature)) {
                    disposeFeature(feature);
                }
            }
        }, myProject);
    }
    final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
    compilerManager.addBeforeTask(new CompileTask() {

        @Override
        public boolean execute(final CompileContext context) {
            close();
            return true;
        }
    });
}
Also used : CompileTask(com.intellij.openapi.compiler.CompileTask) RegistryValue(com.intellij.openapi.util.registry.RegistryValue) CompilerManager(com.intellij.openapi.compiler.CompilerManager) RegistryValueListener(com.intellij.openapi.util.registry.RegistryValueListener) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 5 with CompileTask

use of com.intellij.openapi.compiler.CompileTask in project intellij-community by JetBrains.

the class GradleStartupActivity method runActivity.

@Override
public void runActivity(@NotNull final Project project) {
    configureBuildClasspath(project);
    showNotificationForUnlinkedGradleProject(project);
    final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(project);
    CompilerManager.getInstance(project).addBeforeTask(new CompileTask() {

        @Override
        public boolean execute(CompileContext context) {
            AccessToken token = ReadAction.start();
            try {
                buildConfigurationGenerator.generateBuildConfiguration(context);
            } finally {
                token.finish();
            }
            return true;
        }
    });
}
Also used : GradleResourceCompilerConfigurationGenerator(org.jetbrains.plugins.gradle.config.GradleResourceCompilerConfigurationGenerator) CompileTask(com.intellij.openapi.compiler.CompileTask) AccessToken(com.intellij.openapi.application.AccessToken) CompileContext(com.intellij.openapi.compiler.CompileContext)

Aggregations

CompileContext (com.intellij.openapi.compiler.CompileContext)6 CompileTask (com.intellij.openapi.compiler.CompileTask)6 AccessToken (com.intellij.openapi.application.AccessToken)3 CompilerManager (com.intellij.openapi.compiler.CompilerManager)3 GradleResourceCompilerConfigurationGenerator (org.jetbrains.plugins.gradle.config.GradleResourceCompilerConfigurationGenerator)2 StartupManagerEx (com.intellij.ide.startup.StartupManagerEx)1 RegistryValue (com.intellij.openapi.util.registry.RegistryValue)1 RegistryValueListener (com.intellij.openapi.util.registry.RegistryValueListener)1