本文整理匯總了Java中com.intellij.execution.configurations.GeneralCommandLine.withWorkDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralCommandLine.withWorkDirectory方法的具體用法?Java GeneralCommandLine.withWorkDirectory怎麽用?Java GeneralCommandLine.withWorkDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.execution.configurations.GeneralCommandLine
的用法示例。
在下文中一共展示了GeneralCommandLine.withWorkDirectory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doCreateConsoleCmdLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@NotNull
protected GeneralCommandLine doCreateConsoleCmdLine(Sdk sdk,
Map<String, String> environmentVariables,
String workingDir,
int[] ports,
PythonHelper helper) {
PyConsoleOptions.PyConsoleSettings settings = PyConsoleOptions.getInstance(getProject()).getPythonConsoleSettings();
GeneralCommandLine cmd =
PythonCommandLineState.createPythonCommandLine(getProject(), new PythonConsoleRunParams(settings, workingDir, sdk,
environmentVariables));
cmd.withWorkDirectory(getWorkingDir());
ParamsGroup group = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
helper.addToGroup(group, cmd);
for (int port : ports) {
group.addParameter(String.valueOf(port));
}
return cmd;
}
示例2: setWorkingDirectory
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
protected void setWorkingDirectory(@NotNull final GeneralCommandLine cmd) {
final String workingDirectory = myConfiguration.getWorkingDirectory();
if (!StringUtil.isEmptyOrSpaces(workingDirectory)) {
cmd.withWorkDirectory(workingDirectory);
}
else if (myConfiguration instanceof AbstractPythonTestRunConfiguration) {
final String folderName = ((AbstractPythonTestRunConfiguration)myConfiguration).getFolderName();
if (!StringUtil.isEmptyOrSpaces(folderName)) {
cmd.withWorkDirectory(folderName);
}
else {
final String scriptName = ((AbstractPythonTestRunConfiguration)myConfiguration).getScriptName();
if (StringUtil.isEmptyOrSpaces(scriptName)) return;
final VirtualFile script = LocalFileSystem.getInstance().findFileByPath(scriptName);
if (script == null) return;
cmd.withWorkDirectory(script.getParent().getPath());
}
}
if (cmd.getWorkDirectory() == null) { // If current dir still not set, lets use project dir
cmd.setWorkDirectory(myConfiguration.getWorkingDirectorySafe());
}
}
示例3: createCheckProcess
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
Process createCheckProcess(@NotNull final Project project, @NotNull final String executablePath) throws ExecutionException {
final Sdk sdk = PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
PyEduPluginConfigurator configurator = new PyEduPluginConfigurator();
String testsFileName = configurator.getTestFileName();
if (myTask instanceof TaskWithSubtasks) {
testsFileName = FileUtil.getNameWithoutExtension(testsFileName);
int index = ((TaskWithSubtasks)myTask).getActiveSubtaskIndex();
testsFileName += EduNames.SUBTASK_MARKER + index + "." + FileUtilRt.getExtension(configurator.getTestFileName());
}
final File testRunner = new File(myTaskDir.getPath(), testsFileName);
myCommandLine = new GeneralCommandLine();
myCommandLine.withWorkDirectory(myTaskDir.getPath());
final Map<String, String> env = myCommandLine.getEnvironment();
final VirtualFile courseDir = project.getBaseDir();
if (courseDir != null) {
env.put(PYTHONPATH, courseDir.getPath());
}
if (sdk != null) {
String pythonPath = sdk.getHomePath();
if (pythonPath != null) {
myCommandLine.setExePath(pythonPath);
myCommandLine.addParameter(testRunner.getPath());
myCommandLine.addParameter(FileUtil.toSystemDependentName(executablePath));
return myCommandLine.createProcess();
}
}
return null;
}
示例4: createCheckProcess
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public Process createCheckProcess(@NotNull final Project project, @NotNull final String executablePath) throws ExecutionException {
final Sdk sdk = PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
Course course = myTask.getLesson().getCourse();
StudyLanguageManager manager = StudyUtils.getLanguageManager(course);
if (manager == null) {
LOG.info("Language manager is null for " + course.getLanguageById().getDisplayName());
return null;
}
final File testRunner = new File(myTaskDir.getPath(), manager.getTestFileName());
final GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.withWorkDirectory(myTaskDir.getPath());
final Map<String, String> env = commandLine.getEnvironment();
final VirtualFile courseDir = project.getBaseDir();
if (courseDir != null) {
env.put(PYTHONPATH, courseDir.getPath());
}
if (sdk != null) {
String pythonPath = sdk.getHomePath();
if (pythonPath != null) {
commandLine.setExePath(pythonPath);
commandLine.addParameter(testRunner.getPath());
File resourceFile = new File(course.getCourseDirectory());
commandLine.addParameter(resourceFile.getPath());
commandLine.addParameter(FileUtil.toSystemDependentName(executablePath));
return commandLine.createProcess();
}
}
return null;
}
示例5: setupJVMCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public static GeneralCommandLine setupJVMCommandLine(final String exePath,
final SimpleJavaParameters javaParameters,
final boolean forceDynamicClasspath) {
final GeneralCommandLine commandLine = new GeneralCommandLine(exePath);
final ParametersList vmParametersList = javaParameters.getVMParametersList();
commandLine.withEnvironment(javaParameters.getEnv());
commandLine.withParentEnvironmentType(javaParameters.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
final Class commandLineWrapper;
if ((commandLineWrapper = getCommandLineWrapperClass()) != null) {
if (forceDynamicClasspath && !vmParametersList.hasParameter("-classpath") && !vmParametersList.hasParameter("-cp")) {
if (isClassPathJarEnabled(javaParameters, PathUtil.getJarPathForClass(ClassPath.class))) {
appendJarClasspathParams(javaParameters, commandLine, vmParametersList, commandLineWrapper);
}
else {
appendOldCommandLineWrapper(javaParameters, commandLine, vmParametersList, commandLineWrapper);
}
}
else {
appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
}
}
else {
appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
}
final String mainClass = javaParameters.getMainClass();
final String jarPath = javaParameters.getJarPath();
if (mainClass != null) {
commandLine.addParameter(mainClass);
}
else if (jarPath != null) {
commandLine.addParameter("-jar");
commandLine.addParameter(jarPath);
}
commandLine.addParameters(javaParameters.getProgramParametersList().getList());
commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());
return commandLine;
}