本文整理汇总了Java中com.intellij.execution.configurations.JavaCommandLine类的典型用法代码示例。如果您正苦于以下问题:Java JavaCommandLine类的具体用法?Java JavaCommandLine怎么用?Java JavaCommandLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaCommandLine类属于com.intellij.execution.configurations包,在下文中一共展示了JavaCommandLine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCommandLineProxy
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
public ProcessProxy createCommandLineProxy(final JavaCommandLine javaCmdLine) throws ExecutionException {
ProcessProxyImpl proxy = null;
final JavaParameters javaParameters = javaCmdLine.getJavaParameters();
String mainClass = javaParameters.getMainClass();
if (ProcessProxyImpl.useLauncher() && mainClass != null) {
try {
proxy = new ProcessProxyImpl();
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
final ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, String.valueOf(proxy.getPortNumber()));
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BINPATH, PathManager.getBinPath());
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS);
}
catch (ProcessProxyImpl.NoMoreSocketsException e) {
proxy = null;
}
}
return proxy;
}
示例2: createCommandLineProxy
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
public ProcessProxy createCommandLineProxy(final JavaCommandLine javaCmdLine) throws ExecutionException {
ProcessProxyImpl proxy = null;
if (ProcessProxyImpl.useLauncher()) {
try {
proxy = new ProcessProxyImpl();
final JavaParameters javaParameters = javaCmdLine.getJavaParameters();
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
final ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, String.valueOf(proxy.getPortNumber()));
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BINPATH, PathManager.getBinPath());
javaParameters.getProgramParametersList().prepend(javaParameters.getMainClass());
javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS);
}
catch (ProcessProxyImpl.NoMoreSocketsException e) {
proxy = null;
}
}
return proxy;
}
示例3: getRunJre
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
@Nullable
@Override
public Sdk getRunJre()
{
if(state instanceof JavaCommandLine)
{
try
{
return ((JavaCommandLine) state).getJavaParameters().getJdk();
}
catch(ExecutionException ignore)
{
}
}
return null;
}
示例4: createExecutionResult
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
@Override
public ExecutionResult createExecutionResult() throws ExecutionException
{
// debug port may have changed, reinit parameters just in case
if(myNeedParametersSet && state instanceof JavaCommandLine)
{
DebuggerManagerImpl.createDebugParameters(((JavaCommandLine) state).getJavaParameters(), true, DebuggerSettings.SOCKET_TRANSPORT, myRemoteConnection.getAddress(), false);
}
return state.execute(environment.getExecutor(), environment.getRunner());
}
示例5: createCommandLineProxy
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
@Nullable
public abstract ProcessProxy createCommandLineProxy(JavaCommandLine javaCmdLine) throws ExecutionException;
示例6: doExecute
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException
{
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult;
boolean shouldAddDefaultActions = true;
if(state instanceof JavaCommandLine)
{
final OwnJavaParameters parameters = ((JavaCommandLine) state).getJavaParameters();
patch(parameters, env.getRunnerSettings(), env.getRunProfile(), true);
ProcessProxy proxy = ProcessProxyFactory.getInstance().createCommandLineProxy((JavaCommandLine) state);
executionResult = state.execute(env.getExecutor(), this);
if(proxy != null)
{
ProcessHandler handler = executionResult != null ? executionResult.getProcessHandler() : null;
if(handler != null)
{
proxy.attach(handler);
handler.addProcessListener(new ProcessAdapter()
{
@Override
public void processTerminated(@NotNull ProcessEvent event)
{
proxy.destroy();
}
});
}
else
{
proxy.destroy();
}
}
if(state instanceof JavaCommandLineState && !((JavaCommandLineState) state).shouldAddJavaProgramRunnerActions())
{
shouldAddDefaultActions = false;
}
}
else
{
executionResult = state.execute(env.getExecutor(), this);
}
if(executionResult == null)
{
return null;
}
onProcessStarted(env.getRunnerSettings(), executionResult);
final RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, env);
if(shouldAddDefaultActions)
{
addDefaultActions(contentBuilder, executionResult);
}
return contentBuilder.showRunContent(env.getContentToReuse());
}
示例7: createCommandLineProxy
import com.intellij.execution.configurations.JavaCommandLine; //导入依赖的package包/类
@Override
public ProcessProxy createCommandLineProxy(JavaCommandLine javaCmdLine) throws ExecutionException
{
OwnJavaParameters javaParameters = javaCmdLine.getJavaParameters();
String mainClass = javaParameters.getMainClass();
if(ourMayUseLauncher && mainClass != null)
{
String rtJarPath = JavaSdkUtil.getJavaRtJarPath();
boolean runtimeJarFile = new File(rtJarPath).isFile();
if(runtimeJarFile || javaParameters.getModuleName() == null)
{
try
{
ProcessProxyImpl proxy = new ProcessProxyImpl(StringUtil.getShortName(mainClass));
String port = String.valueOf(proxy.getPortNumber());
String binPath = new File(PluginManager.getPluginPath(JavaClassNames.class), "breakgen").getPath();
if(runtimeJarFile && JavaSdkUtil.isJdkAtLeast(javaParameters.getJdk(), JavaSdkVersion.JDK_1_5))
{
javaParameters.getVMParametersList().add("-javaagent:" + rtJarPath + '=' + port + ':' + binPath);
}
else
{
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(AppMainV2.LAUNCHER_PORT_NUMBER, port);
vmParametersList.defineProperty(AppMainV2.LAUNCHER_BIN_PATH, binPath);
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(AppMainV2.class.getName());
}
return proxy;
}
catch(Exception e)
{
Logger.getInstance(ProcessProxy.class).warn(e);
}
}
}
return null;
}