use of com.intellij.execution.configurations.RunConfigurationModule in project intellij-community by JetBrains.
the class GroovyScriptRunConfigurationProducer method createConfiguration.
@Nullable
private RunnerAndConfigurationSettings createConfiguration(@Nullable final PsiClass aClass) {
if (aClass == null)
return null;
final Project project = aClass.getProject();
RunnerAndConfigurationSettings settings = RunManagerEx.getInstanceEx(project).createConfiguration("", getConfigurationFactory());
final GroovyScriptRunConfiguration configuration = (GroovyScriptRunConfiguration) settings.getConfiguration();
final PsiFile file = aClass.getContainingFile().getOriginalFile();
final PsiDirectory dir = file.getContainingDirectory();
if (dir != null) {
configuration.setWorkingDirectory(dir.getVirtualFile().getPath());
}
final VirtualFile vFile = file.getVirtualFile();
if (vFile == null)
return null;
String path = ScriptFileUtil.getScriptFilePath(vFile);
configuration.setScriptPath(path);
RunConfigurationModule module = configuration.getConfigurationModule();
String name = GroovyRunnerUtil.getConfigurationName(aClass, module);
configuration.setName(StringUtil.isEmpty(name) ? vFile.getName() : name);
configuration.setModule(JavaExecutionUtil.findModule(aClass));
return settings;
}
use of com.intellij.execution.configurations.RunConfigurationModule in project intellij-community by JetBrains.
the class JavaParametersUtil method 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;
}
use of com.intellij.execution.configurations.RunConfigurationModule in project intellij-community by JetBrains.
the class JavaParametersUtil method configureModule.
public static void configureModule(final RunConfigurationModule runConfigurationModule, final JavaParameters parameters, @MagicConstant(valuesFromClass = JavaParameters.class) final int classPathType, @Nullable String jreHome) throws CantRunException {
Module module = runConfigurationModule.getModule();
if (module == null) {
throw CantRunException.noModuleConfigured(runConfigurationModule.getModuleName());
}
configureModule(module, parameters, classPathType, jreHome);
}
use of com.intellij.execution.configurations.RunConfigurationModule in project intellij-community by JetBrains.
the class TestMethods method createJavaParameters.
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createDefaultJavaParameters();
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final RunConfigurationModule configurationModule = getConfiguration().getConfigurationModule();
final Project project = configurationModule.getProject();
final Module module = configurationModule.getModule();
final GlobalSearchScope searchScope = module != null ? module.getModuleRuntimeScope(true) : GlobalSearchScope.allScope(project);
addClassesListToJavaParameters(myFailedTests, testInfo -> testInfo != null ? getTestPresentation(testInfo, project, searchScope) : null, data.getPackageName(), true, javaParameters);
return javaParameters;
}
Aggregations