Search in sources :

Example 6 with CompileStatusNotification

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

the class AppEngineUploader method compileAndUpload.

private void compileAndUpload() {
    final Runnable startUploading = () -> ApplicationManager.getApplication().invokeLater(() -> startUploadingProcess());
    final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
    final CompileScope moduleScope = compilerManager.createModuleCompileScope(myAppEngineFacet.getModule(), true);
    final CompileScope compileScope = ArtifactCompileScope.createScopeWithArtifacts(moduleScope, Collections.singletonList(myArtifact));
    ApplicationManager.getApplication().invokeLater(() -> compilerManager.make(compileScope, new CompileStatusNotification() {

        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            if (!aborted && errors == 0) {
                startUploading.run();
            }
        }
    }));
}
Also used : CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) CompileScope(com.intellij.openapi.compiler.CompileScope) ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 7 with CompileStatusNotification

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

the class ShowSerializedXmlAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final PsiClass psiClass = getPsiClass(e);
    if (psiClass == null)
        return;
    final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
    final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
    if (module == null || virtualFile == null)
        return;
    final String className = ClassUtil.getJVMClassName(psiClass);
    final Project project = getEventProject(e);
    CompilerManager.getInstance(project).make(new FileSetCompileScope(Collections.singletonList(virtualFile), new Module[] { module }), new CompileStatusNotification() {

        @Override
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            if (aborted || errors > 0)
                return;
            generateAndShowXml(module, className);
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) PsiClass(com.intellij.psi.PsiClass) Module(com.intellij.openapi.module.Module) CompileContext(com.intellij.openapi.compiler.CompileContext) FileSetCompileScope(com.intellij.compiler.impl.FileSetCompileScope)

Example 8 with CompileStatusNotification

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

the class BaseClassesAnalysisAction method compileAndAnalyze.

private void compileAndAnalyze(@NotNull Project project, @NotNull AnalysisScope scope) {
    if (project.isDisposed()) {
        return;
    }
    final CompilerManager compilerManager = CompilerManager.getInstance(project);
    compilerManager.make(compilerManager.createProjectCompileScope(project), new CompileStatusNotification() {

        @Override
        public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
            if (aborted || errors != 0)
                return;
            ApplicationManager.getApplication().invokeLater(() -> doAnalyze(project, scope));
        }
    });
}
Also used : CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 9 with CompileStatusNotification

use of com.intellij.openapi.compiler.CompileStatusNotification in project azure-tools-for-java by Microsoft.

the class IDEHelperImpl method buildArtifact.

private static ListenableFuture<Boolean> buildArtifact(@NotNull Project project, @NotNull final Artifact artifact, boolean rebuild) {
    final SettableFuture<Boolean> future = SettableFuture.create();
    Set<Artifact> artifacts = new LinkedHashSet<Artifact>(1);
    artifacts.add(artifact);
    CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);
    ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
    CompilerManager.getInstance(project).make(scope, new CompileStatusNotification() {

        @Override
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            future.set(!aborted && errors == 0);
        }
    });
    return future;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompileScope(com.intellij.openapi.compiler.CompileScope) CompileContext(com.intellij.openapi.compiler.CompileContext) Artifact(com.intellij.packaging.artifacts.Artifact)

Aggregations

CompileStatusNotification (com.intellij.openapi.compiler.CompileStatusNotification)9 CompileContext (com.intellij.openapi.compiler.CompileContext)8 CompilerManager (com.intellij.openapi.compiler.CompilerManager)5 Module (com.intellij.openapi.module.Module)4 CompileScope (com.intellij.openapi.compiler.CompileScope)3 Project (com.intellij.openapi.project.Project)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 FileSetCompileScope (com.intellij.compiler.impl.FileSetCompileScope)2 ArtifactCompileScope (com.intellij.packaging.impl.compiler.ArtifactCompileScope)2 PsiClassWriter (com.intellij.compiler.PsiClassWriter)1 InstrumentationClassFinder (com.intellij.compiler.instrumentation.InstrumentationClassFinder)1 CantRunException (com.intellij.execution.CantRunException)1 ExecutionException (com.intellij.execution.ExecutionException)1 PropertiesReferenceManager (com.intellij.lang.properties.PropertiesReferenceManager)1 PropertiesFile (com.intellij.lang.properties.psi.PropertiesFile)1 Document (com.intellij.openapi.editor.Document)1 Pair (com.intellij.openapi.util.Pair)1 Artifact (com.intellij.packaging.artifacts.Artifact)1 PsiClass (com.intellij.psi.PsiClass)1 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)1