• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CompilerProjectExtension类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getWizard

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
private AddModuleWizard getWizard(final Project project) throws ConfigurationException {
    final HybrisProjectImportProvider provider = getHybrisProjectImportProvider();
    final String basePath = project.getBasePath();
    final String projectName = project.getName();
    final Sdk jdk = ProjectRootManager.getInstance(project).getProjectSdk();
    final String compilerOutputUrl = CompilerProjectExtension.getInstance(project).getCompilerOutputUrl();
    final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();

    final AddModuleWizard wizard = new AddModuleWizard(null, basePath, provider) {

        protected void init() {
            // non GUI mode
        }
    };
    final WizardContext wizardContext = wizard.getWizardContext();
    wizardContext.setProjectJdk(jdk);
    wizardContext.setProjectName(projectName);
    wizardContext.setCompilerOutputDirectory(compilerOutputUrl);
    final StepSequence stepSequence = wizard.getSequence();
    for (ModuleWizardStep step : stepSequence.getAllSteps()) {
        if (step instanceof NonGuiSupport) {
            ((NonGuiSupport) step).nonGuiModeImport(settings);
        }
    }
    return wizard;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:ProjectRefreshAction.java


示例2: CompilerTester

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public CompilerTester(Project project, List<Module> modules) throws Exception {
  myProject = project;
  myModules = modules;
  myMainOutput = new TempDirTestFixtureImpl();
  myMainOutput.setUp();

  CompilerTestUtil.enableExternalCompiler();
  new WriteCommandAction(getProject()) {
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      //noinspection ConstantConditions
      CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
      for (Module module : myModules) {
        ModuleRootModificationUtil.setModuleSdk(module, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
      }
    }
  }.execute();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CompilerTester.java


示例3: getExcludeRootsForModule

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) {
  ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>();
  final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class);
  if (extension == null) {
    return VirtualFilePointer.EMPTY_ARRAY;
  }
  if (extension.isCompilerOutputPathInherited()) {
    ContainerUtil.addIfNotNull(result, CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer());
  }
  else {
    if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY;
    ContainerUtil.addIfNotNull(result, extension.getCompilerOutputPointer());
    ContainerUtil.addIfNotNull(result, extension.getCompilerOutputForTestsPointer());
  }
  return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExcludeCompilerOutputPolicy.java


示例4: compile

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public static Class compile(@NotNull PsiClass psiClass) {
    Class cls = null;

    String compileText = psiClass.getText();
    String compileName = psiClass.getName();
    CompilerProjectExtension extension = CompilerProjectExtension.getInstance(psiClass.getProject());
    String outputRootUrl = extension.getCompilerOutputUrl();
    File root = new File(outputRootUrl + "/tmp");
    File sourceFile = new File(root, compileName + ".java");
    sourceFile.getParentFile().mkdirs();
    try {
        new FileWriter(sourceFile).append(compileText).close();

        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        compiler.run(null, null, null, sourceFile.getPath());

        URLClassLoader classLoader = URLClassLoader.newInstance(new URL[]{root.toURI().toURL()});
        cls = Class.forName(compileName, true, classLoader);
        sourceFile.delete();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return cls;
}
 
开发者ID:nrudenko,项目名称:OrmGeneratorPlugin,代码行数:25,代码来源:CompileSourceInMemory.java


示例5: CompilerTester

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public CompilerTester(boolean externalMake, Module module) throws Exception {
  myExternalMake = externalMake;
  myModule = module;
  myMainOutput = new TempDirTestFixtureImpl();
  myMainOutput.setUp();

  CompilerManagerImpl.testSetup();
  new WriteCommandAction(getProject()) {
    @Override
    protected void run(Result result) throws Throwable {
      //noinspection ConstantConditions
      CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
      if (myExternalMake) {
        CompilerTestUtil.enableExternalCompiler(getProject());
        ModuleRootModificationUtil.setModuleSdk(myModule, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
      }
      else {
        CompilerTestUtil.disableExternalCompiler(getProject());
      }
    }
  }.execute();

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:CompilerTester.java


示例6: getExcludeRootsForModule

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) {
  ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>();
  final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class);
  if (extension == null) {
    return VirtualFilePointer.EMPTY_ARRAY;
  }
  if (extension.isCompilerOutputPathInherited()) {
    result.add(CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer());
  }
  else {
    if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY;
    final VirtualFilePointer outputPath = extension.getCompilerOutputPointer();
    if (outputPath != null) result.add(outputPath);
    final VirtualFilePointer outputPathForTests = extension.getCompilerOutputForTestsPointer();
    if (outputPathForTests != null) result.add(outputPathForTests);
  }
  return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ExcludeCompilerOutputPolicy.java


示例7: setCompilerOutput

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
protected void setCompilerOutput(@NotNull Project project) {
  CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(project);
  String basePath = project.getBasePath();
  if (compilerProjectExtension != null && basePath != null) {
    compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(FileUtilRt.toSystemDependentName(basePath)));
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:8,代码来源:EduIntellijCourseProjectGeneratorBase.java


示例8: getCompilerOutputPath

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public VirtualFile getCompilerOutputPath() {
  if (myInheritedCompilerOutput) {
    final VirtualFile projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutput();
    if (projectOutputPath == null) return null;
    return projectOutputPath.findFileByRelativePath(PRODUCTION + "/" + getModule().getName());
  }
  return myCompilerOutputPointer == null ? null : myCompilerOutputPointer.getFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompilerModuleExtensionImpl.java


示例9: getCompilerOutputPathForTests

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public VirtualFile getCompilerOutputPathForTests() {
  if (myInheritedCompilerOutput) {
    final VirtualFile projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutput();
    if (projectOutputPath == null) return null;
    return projectOutputPath.findFileByRelativePath(TEST + "/" + getModule().getName());
  }
  return myCompilerOutputPathForTestsPointer == null ? null : myCompilerOutputPathForTestsPointer.getFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompilerModuleExtensionImpl.java


示例10: getCompilerOutputUrl

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public String getCompilerOutputUrl() {
  if (myInheritedCompilerOutput) {
    final String projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutputUrl();
    if (projectOutputPath == null) return null;
    return projectOutputPath + "/" + PRODUCTION + "/" + getModule().getName();
  }
  return myCompilerOutputPointer == null ? null : myCompilerOutputPointer.getUrl();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompilerModuleExtensionImpl.java


示例11: getCompilerOutputUrlForTests

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public String getCompilerOutputUrlForTests() {
  if (myInheritedCompilerOutput) {
    final String projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutputUrl();
    if (projectOutputPath == null) return null;
    return projectOutputPath + "/" + TEST + "/" + getModule().getName();
  }
  return myCompilerOutputPathForTestsPointer == null ? null : myCompilerOutputPathForTestsPointer.getUrl();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompilerModuleExtensionImpl.java


示例12: getExcludeRootsForProject

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getExcludeRootsForProject() {
  VirtualFile outputPath = CompilerProjectExtension.getInstance(myProject).getCompilerOutput();
  if (outputPath != null) {
    return new VirtualFile[] { outputPath };
  }
  return VirtualFile.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExcludeCompilerOutputPolicy.java


示例13: getDefaultArtifactOutputPath

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Nullable
public static String getDefaultArtifactOutputPath(@NotNull String artifactName, final @NotNull Project project) {
  final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(project);
  if (extension == null) return null;
  String outputUrl = extension.getCompilerOutputUrl();
  if (outputUrl == null || outputUrl.length() == 0) {
    final VirtualFile baseDir = project.getBaseDir();
    if (baseDir == null) return null;
    outputUrl = baseDir.getUrl() + "/out";
  }
  return VfsUtilCore.urlToPath(outputUrl) + "/artifacts/" + FileUtil.sanitizeFileName(artifactName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ArtifactUtil.java


示例14: testProjectOutput

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public void testProjectOutput() throws IOException {
  VirtualFile output = getVirtualFile(createTempDir("projectOutput"));
  CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(output.getUrl());
  getChangeListManager().convertExcludedToIgnored();
  assertTrue(getChangeListManager().isIgnoredFile(output));
  assertIgnored(output);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ConvertExcludedToIgnoredTest.java


示例15: testModuleOutputUnderProjectOutput

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public void testModuleOutputUnderProjectOutput() throws IOException {
  VirtualFile output = getVirtualFile(createTempDir("projectOutput"));
  CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(output.getUrl());
  VirtualFile moduleOutput = createChildDirectory(output, "module");
  PsiTestUtil.setCompilerOutputPath(myModule, moduleOutput.getUrl(), false);
  getChangeListManager().convertExcludedToIgnored();
  assertTrue(getChangeListManager().isIgnoredFile(output));
  assertTrue(getChangeListManager().isIgnoredFile(moduleOutput));
  assertIgnored(output);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ConvertExcludedToIgnoredTest.java


示例16: isExcludeRoot

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
public boolean isExcludeRoot(final VirtualFile file) {
  CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(myProject);
  if (isEqualWithFileOrUrl(file, compilerProjectExtension.getCompilerOutput(), compilerProjectExtension.getCompilerOutputUrl())) return true;

  for (Module m : ModuleManager.getInstance(myProject).getModules()) {
    CompilerModuleExtension rm = CompilerModuleExtension.getInstance(m);
    if (isEqualWithFileOrUrl(file, rm.getCompilerOutputPath(), rm.getCompilerOutputUrl())) return true;
    if (isEqualWithFileOrUrl(file, rm.getCompilerOutputPathForTests(), rm.getCompilerOutputUrlForTests())) return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ExcludeCompilerOutputPolicy.java


示例17: getDefaultArtifactOutputPath

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Nullable
public static String getDefaultArtifactOutputPath(@NotNull String artifactName, final @NotNull Project project) {
  final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(project);
  if (extension == null) return null;
  String outputUrl = extension.getCompilerOutputUrl();
  if (outputUrl == null || outputUrl.length() == 0) {
    final VirtualFile baseDir = project.getBaseDir();
    if (baseDir == null) return null;
    outputUrl = baseDir.getUrl() + "/out";
  }
  return VfsUtil.urlToPath(outputUrl) + "/artifacts/" + FileUtil.sanitizeFileName(artifactName);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ArtifactUtil.java


示例18: getImpl

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
private static CompilerProjectExtensionImpl getImpl(final Project project) {
  return (CompilerProjectExtensionImpl)CompilerProjectExtension.getInstance(project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:CompilerProjectExtensionImpl.java


示例19: getOriginalCompilerOutputUrl

import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Nullable
private String getOriginalCompilerOutputUrl() {
  final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(myProject);
  return extension != null ? extension.getCompilerOutputUrl() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ProjectConfigurable.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WeightedSpanTermExtractor类代码示例发布时间:2022-05-22
下一篇:
Java StringUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap