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


Java JavaParameters.JDK_AND_CLASSES_AND_TESTS属性代码示例

本文整理汇总了Java中com.intellij.execution.configurations.JavaParameters.JDK_AND_CLASSES_AND_TESTS属性的典型用法代码示例。如果您正苦于以下问题:Java JavaParameters.JDK_AND_CLASSES_AND_TESTS属性的具体用法?Java JavaParameters.JDK_AND_CLASSES_AND_TESTS怎么用?Java JavaParameters.JDK_AND_CLASSES_AND_TESTS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.execution.configurations.JavaParameters的用法示例。


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

示例1: getClasspathType

public static int getClasspathType(final RunConfigurationModule configurationModule, final String mainClassName,
                                   final boolean classMustHaveSource) throws CantRunException {
  final Module module = configurationModule.getModule();
  if (module == null) throw CantRunException.noModuleConfigured(configurationModule.getModuleName());
  final PsiClass psiClass = JavaExecutionUtil.findMainClass(module, mainClassName);
  if (psiClass == null) {
    if (!classMustHaveSource) return JavaParameters.JDK_AND_CLASSES_AND_TESTS;
    throw CantRunException.classNotFound(mainClassName, module);
  }
  final PsiFile psiFile = psiClass.getContainingFile();
  if (psiFile == null) throw CantRunException.classNotFound(mainClassName, module);
  final VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) throw CantRunException.classNotFound(mainClassName, module);
  Module classModule = psiClass.isValid() ? ModuleUtilCore.findModuleForPsiElement(psiClass) : null;
  if (classModule == null) classModule = module;
  ModuleFileIndex fileIndex = ModuleRootManager.getInstance(classModule).getFileIndex();
  if (fileIndex.isInSourceContent(virtualFile)) {
    return fileIndex.
      isInTestSourceContent(virtualFile) ? JavaParameters.JDK_AND_CLASSES_AND_TESTS : JavaParameters.JDK_AND_CLASSES;
  }
  final List<OrderEntry> entriesForFile = fileIndex.getOrderEntriesForFile(virtualFile);
  for (OrderEntry entry : entriesForFile) {
    if (entry instanceof ExportableOrderEntry && ((ExportableOrderEntry)entry).getScope() == DependencyScope.TEST) return JavaParameters.JDK_AND_CLASSES_AND_TESTS;
  }
  return JavaParameters.JDK_AND_CLASSES;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JavaParametersUtil.java

示例2: createJavaParameters

@Override
protected JavaParameters createJavaParameters() throws ExecutionException {

    final JavaParameters javaParameters = addLivingDocProgramParameterList();

    final int classPathType = JavaParameters.JDK_AND_CLASSES_AND_TESTS;
    final String jreHome = runConfiguration.ALTERNATIVE_JRE_PATH_ENABLED ? runConfiguration.ALTERNATIVE_JRE_PATH : null;
    JavaParametersUtil.configureModule(runConfiguration.getConfigurationModule(), javaParameters, classPathType, jreHome);
    JavaParametersUtil.configureConfiguration(javaParameters, runConfiguration);

    javaParameters.setMainClass(runConfiguration.MAIN_CLASS_NAME);

    return javaParameters;
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-intellij,代码行数:14,代码来源:RunProfileStateLivingDoc.java

示例3: getClasspathType

@MagicConstant(valuesFromClass = JavaParameters.class)
public static int getClasspathType(final RunConfigurationModule configurationModule, final String mainClassName,
                                   final boolean classMustHaveSource) throws CantRunException {
  final Module module = configurationModule.getModule();
  if (module == null) throw CantRunException.noModuleConfigured(configurationModule.getModuleName());
  Boolean inProduction = isClassInProductionSources(mainClassName, module);
  if (inProduction == null) {
    if (!classMustHaveSource) {
      return JavaParameters.JDK_AND_CLASSES_AND_TESTS;
    }
    throw CantRunException.classNotFound(mainClassName, module);
  }

  return inProduction ? JavaParameters.JDK_AND_CLASSES : JavaParameters.JDK_AND_CLASSES_AND_TESTS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaParametersUtil.java


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