当前位置: 首页>>代码示例>>Java>>正文


Java CompilerManager类代码示例

本文整理汇总了Java中com.intellij.openapi.compiler.CompilerManager的典型用法代码示例。如果您正苦于以下问题:Java CompilerManager类的具体用法?Java CompilerManager怎么用?Java CompilerManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompilerManager类属于com.intellij.openapi.compiler包,在下文中一共展示了CompilerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileAndAnalyze

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
private void compileAndAnalyze(final Project project, final 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(new Runnable() {
        @Override
        public void run() {
          doAnalyze(project, scope);
        }
      });
  }});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BaseClassesAnalysisAction.java

示例2: getFilesToPackage

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@NotNull
private static List<VirtualFile> getFilesToPackage(@NotNull AnActionEvent e, @NotNull Project project) {
  final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  if (files == null) return Collections.emptyList();

  List<VirtualFile> result = new ArrayList<VirtualFile>();
  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final CompilerManager compilerManager = CompilerManager.getInstance(project);
  for (VirtualFile file : files) {
    if (file == null || file.isDirectory() ||
        fileIndex.isUnderSourceRootOfType(file, JavaModuleSourceRootTypes.SOURCES) && compilerManager.isCompilableFileType(file.getFileType())) {
      return Collections.emptyList();
    }
    final Collection<? extends Artifact> artifacts = ArtifactBySourceFileFinder.getInstance(project).findArtifacts(file);
    for (Artifact artifact : artifacts) {
      if (!StringUtil.isEmpty(artifact.getOutputPath())) {
        result.add(file);
        break;
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PackageFileAction.java

示例3: doAction

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
protected void doAction(DataContext dataContext, Project project) {
  Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
  Module module;
  if (modules == null) {
    module = LangDataKeys.MODULE.getData(dataContext);
    if (module == null) {
      return;
    }
    modules = new Module[]{module};
  }
  try {
    CompilerManager.getInstance(project).make(modules[0].getProject(), modules, null);
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MakeModuleAction.java

示例4: init

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ExternalSystemTaskActivator.java

示例5: generate

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
private static void generate(Project project, final Module... modules) {
  CompilerManager.getInstance(project).executeTask(new CompileTask() {
    @Override
    public boolean execute(CompileContext context) {
      // todo: compatibility with background autogenerating

      for (Module module : modules) {
        final AndroidFacet facet = AndroidFacet.getInstance(module);

        if (facet != null) {
          for (AndroidAutogeneratorMode mode : AndroidAutogeneratorMode.values()) {
            AndroidCompileUtil.generate(facet, mode, context, true);
          }
        }
      }
      return true;
    }
  }, new ModuleCompileScope(project, modules, false), AndroidBundle.message("android.compile.messages.generating.r.java.content.name"),
                                                   null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidRegenerateSourcesAction.java

示例6: buildAndSignIntellijProject

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
private void buildAndSignIntellijProject() {
  CompilerManager.getInstance(myProject).make(myCompileScope, new CompileStatusNotification() {
    @Override
    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
      if (aborted || errors != 0) {
        return;
      }

      final String title = AndroidBundle.message("android.extract.package.task.title");
      ProgressManager.getInstance().run(new Task.Backgroundable(myProject, title, true, null) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          createAndAlignApk(myApkPath);
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExportSignedPackageWizard.java

示例7: setUpInWriteAction

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@Override
protected void setUpInWriteAction() throws Exception {
  super.setUpInWriteAction();

  final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(myProject);
  CompilerManager.getInstance(myProject).addBeforeTask(new CompileTask() {
    @Override
    public boolean execute(CompileContext context) {
      AccessToken token = ReadAction.start();
      try {
        buildConfigurationGenerator.generateBuildConfiguration(context);
      }
      finally {
        token.finish();
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleCompilingTestCase.java

示例8: runActivity

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GradleStartupActivity.java

示例9: compileAndUpload

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
private void compileAndUpload() {
  final Runnable startUploading = new Runnable() {
    public void run() {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
          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(new Runnable() {
    public void run() {
      compilerManager.make(compileScope, new CompileStatusNotification() {
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
          if (!aborted && errors == 0) {
            startUploading.run();
          }
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AppEngineUploader.java

示例10: initComponent

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenTasksManager.java

示例11: actionPerformed

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@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);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ShowSerializedXmlAction.java

示例12: actionPerformed

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
    final CreateIpaDialog dialog = new CreateIpaDialog(e.getProject());
    dialog.show();
    if(dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
        // create IPA
        IpaConfig ipaConfig = dialog.getIpaConfig();
        CompileScope scope = CompilerManager.getInstance(e.getProject()).createModuleCompileScope(ipaConfig.module, true);
        scope.putUserData(IPA_CONFIG_KEY, ipaConfig);
        CompilerManager.getInstance(e.getProject()).compile(scope, new CompileStatusNotification() {
            @Override
            public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
                RoboVmPlugin.logInfo(e.getProject(), "IPA creation complete, %d errors, %d warnings", errors, warnings);
            }
        });
    }
}
 
开发者ID:robovm,项目名称:robovm-idea,代码行数:17,代码来源:CreateIpaAction.java

示例13: initComponent

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
public void initComponent() {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
        public void run() {
            FileTypeManager.getInstance().registerFileType(F3_FILE_TYPE, F3_FILE_EXTENSION);

            ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
                public void projectOpened(Project project) {
                    CompilerManager compilerManager = CompilerManager.getInstance(project);
                    compilerManager.addCompiler(new F3Compiler());
                    compilerManager.addCompilableFileType(F3_FILE_TYPE);

                    DebuggerManager.getInstance (project).registerPositionManagerFactory (new Function<DebugProcess, PositionManager>() {
                        public PositionManager fun (DebugProcess debugProcess) {
                            return new F3PositionManager (debugProcess);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:F3Plugin.java

示例14: registerManagerExecution

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
private void registerManagerExecution(Project project, ExecutionMoment executionMoment) {
  CompilerManager compilerManager = CompilerManager.getInstance(project);
  switch (executionMoment) {
    case BEFORE:
      compilerManager.addBeforeTask(this);
      break;
    case AFTER:
      compilerManager.addAfterTask(this);
      break;
    case BOTH:
      compilerManager.addBeforeTask(this);
      compilerManager.addAfterTask(this);
      break;
    default:
      throw new IllegalStateException("Cannot be reached");
  }
}
 
开发者ID:bsblabs,项目名称:intellij-xmlbeans-plugin,代码行数:18,代码来源:AbstractFacetCompileTaskManager.java

示例15: getFilesToPackage

import com.intellij.openapi.compiler.CompilerManager; //导入依赖的package包/类
@NotNull
private static List<VirtualFile> getFilesToPackage(@NotNull AnActionEvent e, @NotNull Project project) {
  final VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
  if (files == null) return Collections.emptyList();

  List<VirtualFile> result = new ArrayList<VirtualFile>();
  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final CompilerManager compilerManager = CompilerManager.getInstance(project);
  for (VirtualFile file : files) {
    if (file == null || file.isDirectory() ||
        fileIndex.isInSourceContent(file) && compilerManager.isCompilableFileType(file.getFileType())) {
      return Collections.emptyList();
    }
    final Collection<? extends Artifact> artifacts = ArtifactBySourceFileFinder.getInstance(project).findArtifacts(file);
    for (Artifact artifact : artifacts) {
      if (!StringUtil.isEmpty(artifact.getOutputPath())) {
        result.add(file);
        break;
      }
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:PackageFileAction.java


注:本文中的com.intellij.openapi.compiler.CompilerManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。