本文整理汇总了Java中com.intellij.execution.runners.ExecutionEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionEnvironment类的具体用法?Java ExecutionEnvironment怎么用?Java ExecutionEnvironment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionEnvironment类属于com.intellij.execution.runners包,在下文中一共展示了ExecutionEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: attachVirtualMachine
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Nullable
protected RunContentDescriptor attachVirtualMachine(final RunProfileState state, final @NotNull ExecutionEnvironment env)
throws ExecutionException
{
return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter()
{
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException
{
WeaveRunnerCommandLine weaveRunnerCommandLine = (WeaveRunnerCommandLine) state;
final String weaveFile = weaveRunnerCommandLine.getModel().getWeaveFile();
final Project project = weaveRunnerCommandLine.getEnvironment().getProject();
final VirtualFile projectFile = project.getBaseDir();
final String path = project.getBasePath();
final String relativePath = weaveFile.substring(path.length());
final VirtualFile fileByRelativePath = projectFile.findFileByRelativePath(relativePath);
final DebuggerClient localhost = new DebuggerClient(new WeaveDebuggerClientListener(session, fileByRelativePath), new TcpClientDebuggerProtocol("localhost", 6565));
final ExecutionResult result = state.execute(env.getExecutor(), WeaveDebuggerRunner.this);
new DebuggerConnector(localhost).start();
return new WeaveDebugProcess(session, localhost, result);
}
}).getRunContentDescriptor();
}
示例3: testNoWorkingDirsFileWhenOnlyOneModuleExist
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
public void testNoWorkingDirsFileWhenOnlyOneModuleExist() throws Exception {
setupModule("mod1", "T1");
final JUnitConfiguration configuration =
new JUnitConfiguration("p", getProject(), JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
configuration.setWorkingDirectory("$MODULE_DIR$");
final JUnitConfiguration.Data persistentData = configuration.getPersistentData();
persistentData.setScope(TestSearchScope.WHOLE_PROJECT);
persistentData.PACKAGE_NAME = "p";
persistentData.TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
final ExecutionEnvironment environment =
ExecutionEnvironmentBuilder.create(DefaultRunExecutor.getRunExecutorInstance(), configuration).build();
final TestPackage aPackage = new TestPackage(configuration, environment);
aPackage.createSearchingForTestsTask().startSearch();
final File workingDirsFile = aPackage.getWorkingDirsFile();
assertNotNull(workingDirsFile);
assertEmpty(FileUtil.loadFile(workingDirsFile));
}
示例4: BlazeAndroidBinaryMobileInstallRunContext
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
public BlazeAndroidBinaryMobileInstallRunContext(
Project project,
AndroidFacet facet,
RunConfiguration runConfiguration,
ExecutionEnvironment env,
BlazeAndroidBinaryRunConfigurationState configState,
Label label,
ImmutableList<String> blazeFlags,
ImmutableList<String> exeFlags) {
this.project = project;
this.facet = facet;
this.runConfiguration = runConfiguration;
this.env = env;
this.configState = configState;
this.consoleProvider = new BlazeAndroidBinaryConsoleProvider(project);
this.buildStep =
new BlazeApkBuildStepMobileInstall(
project,
env,
label,
blazeFlags,
exeFlags,
configState.useSplitApksIfPossible(),
configState.getLaunchMethod().equals(AndroidBinaryLaunchMethod.MOBILE_INSTALL_V2));
this.applicationIdProvider = new BlazeAndroidBinaryApplicationIdProvider(buildStep);
}
示例5: createContentDescriptor
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Override
@Nullable
protected RunContentDescriptor createContentDescriptor(RunProfileState state, ExecutionEnvironment env)
throws ExecutionException {
// Now we figure out if it the Debug button has been hit
Executor executor = env.getExecutor();
// If was the debug, then we do some extra magic
if (executor instanceof DefaultDebugExecutor) {
// Get hold of the JavaParameters
JavaCommandLine javaCommandLine = (JavaCommandLine) state;
JavaParameters javaParameters = javaCommandLine.getJavaParameters();
// Making the assumption that it's JVM 7 onwards
javaParameters.getVMParametersList().addParametersString(XDEBUG);
// Debugger port
String debuggerPort = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
String remotePort = JDWP + debuggerPort;
javaParameters.getVMParametersList().addParametersString(remotePort);
// Creating a 'Remote' configuration on the fly
RemoteConnection connection = new RemoteConnection(true, LOCALHOST, debuggerPort, false);
// Attaches the remote configuration to the VM and then starts it up
return super.attachVirtualMachine(state, env, connection, true);
} else {
// If it was something else then we don't do anything special
return super.createContentDescriptor(state, env);
}
}
示例6: BlazeApkBuildStepMobileInstall
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
public BlazeApkBuildStepMobileInstall(
Project project,
ExecutionEnvironment env,
Label label,
ImmutableList<String> blazeFlags,
ImmutableList<String> exeFlags,
boolean useSplitApksIfPossible,
boolean mobileInstallV2) {
this.project = project;
this.env = env;
this.label = label;
this.blazeFlags = blazeFlags;
this.exeFlags = exeFlags;
this.useSplitApksIfPossible = useSplitApksIfPossible;
this.mobileInstallV2 = mobileInstallV2;
}
示例7: 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);
}
示例8: fromString
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
public static TestObject fromString(final String id,
final JUnitConfiguration configuration,
@NotNull ExecutionEnvironment environment) {
if (JUnitConfiguration.TEST_METHOD.equals(id)) {
return new TestMethod(configuration, environment);
}
if (JUnitConfiguration.TEST_CLASS.equals(id)) {
return new TestClass(configuration, environment);
}
if (JUnitConfiguration.TEST_PACKAGE.equals(id)){
return new TestPackage(configuration, environment);
}
if (JUnitConfiguration.TEST_DIRECTORY.equals(id)) {
return new TestDirectory(configuration, environment);
}
if (JUnitConfiguration.TEST_CATEGORY.equals(id)) {
return new TestCategory(configuration, environment);
}
if (JUnitConfiguration.TEST_PATTERN.equals(id)) {
return new TestsPattern(configuration, environment);
}
assert false : MESSAGE + id;
return null;
}
示例9: createRunner
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Override
public BlazeCommandRunConfigurationRunner createRunner(
Executor executor, ExecutionEnvironment environment) throws ExecutionException {
Project project = environment.getProject();
Module module = getModule();
AndroidFacet facet = module != null ? AndroidFacet.getInstance(module) : null;
ProjectViewSet projectViewSet = ProjectViewManager.getInstance(project).getProjectViewSet();
BlazeAndroidRunConfigurationValidationUtil.validateExecution(module, facet, projectViewSet);
ImmutableList<String> blazeFlags =
configState
.getCommonState()
.getExpandedBuildFlags(project, projectViewSet, BlazeCommandName.TEST);
ImmutableList<String> exeFlags =
ImmutableList.copyOf(configState.getCommonState().getExeFlagsState().getExpandedFlags());
BlazeAndroidRunContext runContext =
createRunContext(project, facet, environment, blazeFlags, exeFlags);
return new BlazeAndroidRunConfigurationRunner(
module,
runContext,
getCommonState().getDeployTargetManager(),
getCommonState().getDebuggerManager(),
configuration.getUniqueID());
}
示例10: setAutoTestEnabled
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
public void setAutoTestEnabled(@NotNull RunContentDescriptor descriptor, @NotNull ExecutionEnvironment environment, boolean enabled) {
Content content = descriptor.getAttachedContent();
if (content != null) {
if (enabled) {
EXECUTION_ENVIRONMENT_KEY.set(content, environment);
myDocumentWatcher.activate();
}
else {
EXECUTION_ENVIRONMENT_KEY.set(content, null);
if (!hasEnabledAutoTests()) {
myDocumentWatcher.deactivate();
}
ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler != null) {
clearRestarterListener(processHandler);
}
}
}
}
示例11: getState
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
final Module module = getModule();
if (module == null) {
throw new ExecutionException("Module is not specified");
}
if (!isSupport(module)) {
throw new ExecutionException(getNoSdkMessage());
}
final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
final Sdk sdk = rootManager.getSdk();
if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) {
throw CantRunException.noJdkForModule(module);
}
return createCommandLineState(environment, module);
}
示例12: doRun
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
protected void doRun(@NotNull final ExecutionEnvironment environment, @NotNull final Runnable startRunnable) {
Boolean allowSkipRun = environment.getUserData(EXECUTION_SKIP_RUN);
if (allowSkipRun != null && allowSkipRun) {
environment.getProject().getMessageBus().syncPublisher(EXECUTION_TOPIC).processNotStarted(environment.getExecutor().getId(),
environment);
}
else {
// important! Do not use DumbService.smartInvokeLater here because it depends on modality state
// and execution of startRunnable could be skipped if modality state check fails
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!myProject.isDisposed()) {
DumbService.getInstance(myProject).runWhenSmart(startRunnable);
}
}
});
}
}
示例13: isAutoTestEnabledForDescriptor
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
private static boolean isAutoTestEnabledForDescriptor(@NotNull RunContentDescriptor descriptor) {
Content content = descriptor.getAttachedContent();
if (content != null) {
ExecutionEnvironment watched = EXECUTION_ENVIRONMENT_KEY.get(content);
if (watched != null) {
ExecutionEnvironment current = getCurrentEnvironment(content);
boolean result = current != null && equals(current, watched);
if (!result) {
// let GC do its work
EXECUTION_ENVIRONMENT_KEY.set(content, null);
}
return result;
}
}
return false;
}
示例14: setUp
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
final TestConsoleProperties consoleProperties = createConsoleProperties();
final ExecutionEnvironment environment = new ExecutionEnvironment();
myMockResettablePrinter = new MockPrinter(true);
myConsole = new MyConsoleView(consoleProperties, environment);
myConsole.initUI();
myResultsViewer = myConsole.getResultsViewer();
myRootSuite = myResultsViewer.getTestsRootNode();
myEventsProcessor = new GeneralToSMTRunnerEventsConvertor(consoleProperties.getProject(), myResultsViewer.getTestsRootNode(), "SMTestFramework");
myEventsProcessor.onStartTesting();
}
示例15: setUp
import com.intellij.execution.runners.ExecutionEnvironment; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myRootSuite = createSuiteProxy("root");
final TestConsoleProperties consoleProperties = createConsoleProperties();
final ExecutionEnvironment environment = new ExecutionEnvironment();
myResultsForm = new SMTestRunnerResultsForm(
new JLabel(),
consoleProperties
);
Disposer.register(myResultsForm, consoleProperties);
myResultsForm.initUI();
myStatisticsPanel = myResultsForm.getStatisticsPane();
myTestEventsListener = myStatisticsPanel.createTestEventsListener();
}