當前位置: 首頁>>代碼示例>>Java>>正文


Java ExecutionEnvironment類代碼示例

本文整理匯總了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;
      }
    });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:PyDebugRunner.java

示例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();

}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:26,代碼來源:WeaveDebuggerRunner.java

示例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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:JUnitClasspathTest.java

示例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);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:27,代碼來源:BlazeAndroidBinaryMobileInstallRunContext.java

示例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);
    }
}
 
開發者ID:vitorzachi,項目名稱:tomcat-runner,代碼行數:27,代碼來源:TomcatProgramDebugger.java

示例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;
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:17,代碼來源:BlazeApkBuildStepMobileInstall.java

示例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);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:22,代碼來源:BlazeHotSwapManager.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:TestObject.java

示例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());
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:27,代碼來源:BlazeAndroidTestRunConfigurationHandler.java

示例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);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:AutoTestManager.java

示例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);

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:MvcRunConfiguration.java

示例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);
        }
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:ExecutionManagerImpl.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AutoTestManager.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:SMTRunnerConsoleTest.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:SMTRunnerStatisticsPanelTest.java


注:本文中的com.intellij.execution.runners.ExecutionEnvironment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。