本文整理汇总了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;
}
示例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;
}
示例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;
}