本文整理汇总了Java中com.intellij.execution.runners.ExecutionEnvironment.getRunProfile方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionEnvironment.getRunProfile方法的具体用法?Java ExecutionEnvironment.getRunProfile怎么用?Java ExecutionEnvironment.getRunProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.runners.ExecutionEnvironment
的用法示例。
在下文中一共展示了ExecutionEnvironment.getRunProfile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSession
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
protected XDebugSession createSession(@NotNull RunProfileState state, @NotNull final ExecutionEnvironment environment)
throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
final PythonCommandLineState pyState = (PythonCommandLineState)state;
final ServerSocket serverSocket = PythonCommandLineState.createServerSocket();
final int serverLocalPort = serverSocket.getLocalPort();
RunProfile profile = environment.getRunProfile();
final ExecutionResult result =
pyState.execute(environment.getExecutor(), createCommandLinePatchers(environment.getProject(), pyState, profile, serverLocalPort));
return XDebuggerManager.getInstance(environment.getProject()).
startSession(environment, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
PyDebugProcess pyDebugProcess =
createDebugProcess(session, serverSocket, result, pyState);
createConsoleCommunicationAndSetupActions(environment.getProject(), result, pyDebugProcess, session);
return pyDebugProcess;
}
});
}
示例2: findHotSwappableBlazeDebuggerSession
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
if (session == null || !session.isAttached()) {
return null;
}
JavaDebugProcess process = session.getProcess().getXdebugProcess();
if (process == null) {
return null;
}
ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
return null;
}
RunProfile runProfile = env.getRunProfile();
if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
return null;
}
return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
示例3: createConsole
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
public static ConsoleView createConsole(Project project, ProcessHandler processHandler, ExecutionEnvironment executionEnvironment, TesterTestLocator locationProvider) {
TesterRunConfiguration profile = (TesterRunConfiguration) executionEnvironment.getRunProfile();
TesterConsoleProperties properties = new TesterConsoleProperties(profile, executionEnvironment.getExecutor(), locationProvider);
properties.addStackTraceFilter(new XdebugCallStackFilter(project, locationProvider.getPathMapper()));
BaseTestsOutputConsoleView testsOutputConsoleView = SMTestRunnerConnectionUtil.createConsole("Nette Tester", properties);
testsOutputConsoleView.addMessageFilter(new TesterStackTraceFilter(project, locationProvider.getPathMapper()));
testsOutputConsoleView.attachToProcess(processHandler);
Disposer.register(project, testsOutputConsoleView);
return testsOutputConsoleView;
}
示例4: startDebugSession
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Override
public void startDebugSession(@NotNull JavaDebugConnectionData info, @NotNull ExecutionEnvironment executionEnvironment, @NotNull RemoteServer<?> server)
throws ExecutionException {
final Project project = executionEnvironment.getProject();
final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(project);
final JavaDebugServerModeHandler serverModeHandler = info.getServerModeHandler();
boolean serverMode = serverModeHandler != null;
final RemoteConnection remoteConnection = new RemoteConnection(true, info.getHost(), String.valueOf(info.getPort()), serverMode);
DebugEnvironment debugEnvironment = new RemoteServerDebugEnvironment(project, remoteConnection, executionEnvironment.getRunProfile());
DebugUIEnvironment debugUIEnvironment = new RemoteServerDebugUIEnvironment(debugEnvironment, executionEnvironment);
RunContentDescriptor debugContentDescriptor = manager.attachVirtualMachine(debugUIEnvironment);
LOG.assertTrue(debugContentDescriptor != null);
ProcessHandler processHandler = debugContentDescriptor.getProcessHandler();
LOG.assertTrue(processHandler != null);
if (serverMode) {
serverModeHandler.attachRemote();
DebuggerManager.getInstance(executionEnvironment.getProject())
.addDebugProcessListener(processHandler, new DebugProcessAdapter() {
public void processDetached(DebugProcess process, boolean closedByUser) {
try {
serverModeHandler.detachRemote();
}
catch (ExecutionException e) {
LOG.info(e);
}
}
});
}
}
示例5: isUnderRemoteDebug
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
public boolean isUnderRemoteDebug() {
DataContext context = DataManager.getInstance().getDataContext(this);
ExecutionEnvironment env = LangDataKeys.EXECUTION_ENVIRONMENT.getData(context);
if (env != null && env.getRunProfile() instanceof RemoteRunProfile) {
return true;
}
return false;
}
示例6: getScriptName
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Nullable
private static String getScriptName(PythonCommandLineState pyState) {
ExecutionEnvironment environment = pyState.getEnvironment();
if (environment == null) {
return null;
}
RunProfile runProfile = environment.getRunProfile();
if (runProfile instanceof PythonRunConfiguration) {
String name = FileUtil.toSystemIndependentName(((PythonRunConfiguration)runProfile).getScriptName());
return SystemInfo.isWindows ? name.toLowerCase() : name;
}
return null;
}
示例7: doExecute
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult;
RunProfile profile = env.getRunProfile();
if (state instanceof PythonCommandLineState && profile instanceof CommandLinePatcher) {
executionResult = ((PythonCommandLineState)state).execute(env.getExecutor(), (CommandLinePatcher)profile);
}
else {
executionResult = state.execute(env.getExecutor(), this);
}
return executionResult == null ? null : new RunContentBuilder(executionResult, env).showRunContent(env.getContentToReuse());
}
示例8: getConfiguration
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
private static BlazeCommandRunConfiguration getConfiguration(ExecutionEnvironment environment) {
RunProfile runProfile = environment.getRunProfile();
if (runProfile instanceof WrappingRunConfiguration) {
runProfile = ((WrappingRunConfiguration) runProfile).getPeer();
}
return (BlazeCommandRunConfiguration) runProfile;
}
示例9: getConfiguration
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
private static BlazeCommandRunConfiguration getConfiguration(ExecutionEnvironment env) {
RunProfile runProfile = env.getRunProfile();
if (runProfile instanceof WrappingRunConfiguration) {
runProfile = ((WrappingRunConfiguration) runProfile).getPeer();
}
return (BlazeCommandRunConfiguration) runProfile;
}
示例10: doExecute
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Nullable
@Override
protected RunContentDescriptor doExecute(RunProfileState profile, ExecutionEnvironment env)
throws ExecutionException {
WorkspaceRoot root = WorkspaceRoot.fromProjectSafe(env.getProject());
if (root == null) {
return null;
}
RunContentDescriptor result = super.doExecute(profile, env);
if (result == null) {
return null;
}
// remove any old copy of the coverage data
// retrieve coverage data and copy locally
BlazeCommandRunConfiguration blazeConfig = (BlazeCommandRunConfiguration) env.getRunProfile();
BlazeCoverageEnabledConfiguration config =
(BlazeCoverageEnabledConfiguration) CoverageEnabledConfiguration.getOrCreate(blazeConfig);
String coverageFilePath = config.getCoverageFilePath();
File blazeOutputFile = CoverageUtils.getOutputFile(root);
ProcessHandler handler = result.getProcessHandler();
if (handler != null) {
ProcessHandler wrappedHandler =
new ProcessHandlerWrapper(
handler, exitCode -> copyCoverageOutput(blazeOutputFile, coverageFilePath, exitCode));
CoverageHelper.attachToProcess(blazeConfig, wrappedHandler, env.getRunnerSettings());
}
return result;
}
示例11: equals
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
private static boolean equals(@NotNull ExecutionEnvironment env1, @NotNull ExecutionEnvironment env2) {
return env1.getRunProfile() == env2.getRunProfile() &&
env1.getRunner() == env2.getRunner() &&
env1.getExecutor() == env2.getExecutor() &&
env1.getExecutionTarget() == env2.getExecutionTarget();
}
示例12: compileAndRun
import com.intellij.execution.runners.ExecutionEnvironment; //导入方法依赖的package包/类
@Override
public void compileAndRun(@NotNull final Runnable startRunnable,
@NotNull final ExecutionEnvironment environment,
@Nullable final RunProfileState state,
@Nullable final Runnable onCancelRunnable) {
long id = environment.getExecutionId();
if (id == 0) {
id = environment.assignNewExecutionId();
}
RunProfile profile = environment.getRunProfile();
if (!(profile instanceof RunConfiguration)) {
startRunnable.run();
return;
}
final RunConfiguration runConfiguration = (RunConfiguration)profile;
final List<BeforeRunTask> beforeRunTasks = RunManagerEx.getInstanceEx(myProject).getBeforeRunTasks(runConfiguration);
if (beforeRunTasks.isEmpty()) {
startRunnable.run();
}
else {
DataContext context = environment.getDataContext();
final DataContext projectContext = context != null ? context : SimpleDataContext.getProjectContext(myProject);
final long finalId = id;
final Long executionSessionId = new Long(id);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
/**
* @noinspection SSBasedInspection
*/
@Override
public void run() {
for (BeforeRunTask task : beforeRunTasks) {
if (myProject.isDisposed()) {
return;
}
@SuppressWarnings("unchecked")
BeforeRunTaskProvider<BeforeRunTask> provider = BeforeRunTaskProvider.getProvider(myProject, task.getProviderId());
if (provider == null) {
LOG.warn("Cannot find BeforeRunTaskProvider for id='" + task.getProviderId() + "'");
continue;
}
ExecutionEnvironment taskEnvironment = new ExecutionEnvironmentBuilder(environment).contentToReuse(null).build();
taskEnvironment.setExecutionId(finalId);
EXECUTION_SESSION_ID_KEY.set(taskEnvironment, executionSessionId);
if (!provider.executeTask(projectContext, runConfiguration, taskEnvironment, task)) {
if (onCancelRunnable != null) {
SwingUtilities.invokeLater(onCancelRunnable);
}
return;
}
}
doRun(environment, startRunnable);
}
});
}
}