Package com.intellij.execution

Examples of com.intellij.execution.ExecutionException


                                           ExecutionEnvironment env) throws ExecutionException {
    final HaxeApplicationConfiguration configuration = (HaxeApplicationConfiguration)env.getRunProfile();
    final Module module = configuration.getConfigurationModule().getModule();

    if (module == null) {
      throw new ExecutionException(HaxeBundle.message("no.module.for.run.configuration", configuration.getName()));
    }

    final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);

    if (settings.isUseNmmlToBuild()) {
      final NMERunningState nmeRunningState = new NMERunningState(env, module, false);
      return super.doExecute(project, nmeRunningState, contentToReuse, env);
    }

    if (settings.isUseOpenFLToBuild()) {
      final OpenFLRunningState openflRunningState = new OpenFLRunningState(env, module, true);
      return super.doExecute(project, openflRunningState, contentToReuse, env);
    }

    if (configuration.isCustomFileToLaunch() && FileUtilRt.extensionEquals(configuration.getCustomFileToLaunchPath(), "n")) {
      final NekoRunningState nekoRunningState = new NekoRunningState(env, module, configuration.getCustomFileToLaunchPath());
      return super.doExecute(project, nekoRunningState, contentToReuse, env);
    }

    if (configuration.isCustomExecutable()) {
      final String filePath = configuration.isCustomFileToLaunch()
                              ? configuration.getCustomFileToLaunchPath()
                              : getOutputFilePath(module, settings);
      return super.doExecute(project, new CommandLineState(env) {
        @NotNull
        @Override
        protected ProcessHandler startProcess() throws ExecutionException {
          final GeneralCommandLine commandLine = new GeneralCommandLine();
          commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath()));
          commandLine.setExePath(configuration.getCustomExecutablePath());
          commandLine.addParameter(filePath);

          final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject());
          setConsoleBuilder(consoleBuilder);

          return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
        }
      }, contentToReuse, env);
    }

    if (configuration.isCustomFileToLaunch()) {
      BrowserUtil.open(configuration.getCustomFileToLaunchPath());
      return null;
    }

    if (settings.getHaxeTarget() == HaxeTarget.FLASH) {
      BrowserUtil.open(getOutputFilePath(module, settings));
      return null;
    }

    if (settings.getHaxeTarget() != HaxeTarget.NEKO) {
      throw new ExecutionException(HaxeBundle.message("haxe.run.wrong.target", settings.getHaxeTarget()));
    }

    final NekoRunningState nekoRunningState = new NekoRunningState(env, module, null);
    return super.doExecute(project, nekoRunningState, contentToReuse, env);
  }
View Full Code Here


                                                   ExecutionEnvironment env,
                                                   String urlToLaunch,
                                                   String flexSdkName) throws ExecutionException {
    final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
    if (flexSdk == null) {
      throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
    }

    final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, urlToLaunch);

    final XDebugSession debugSession =
      XDebuggerManager.getInstance(module.getProject()).startSession(runner, env, contentToReuse, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
          try {
            final FlashRunnerParameters params = new FlashRunnerParameters();
            params.setModuleName(module.getName());
            return new HaxeDebugProcess(session, bc, params);
          }
          catch (IOException e) {
            throw new ExecutionException(e.getMessage(), e);
          }
        }
      });

    return debugSession.getRunContentDescriptor();
View Full Code Here

                                                      RunContentDescriptor contentToReuse,
                                                      final ExecutionEnvironment env,
                                                      final Executor executor, String flexSdkName) throws ExecutionException {
    final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
    if (flexSdk == null) {
      throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
    }

    final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null);

    final XDebugSession debugSession =
      XDebuggerManager.getInstance(module.getProject()).startSession(runner, env, contentToReuse, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
          try {
            NMERunningState runningState = new NMERunningState(env, module, false, true);
            final ExecutionResult executionResult = runningState.execute(executor, runner);
            final BCBasedRunnerParameters params = new BCBasedRunnerParameters();
            params.setModuleName(module.getName());
            return new HaxeDebugProcess(session, bc, params);
          }
          catch (IOException e) {
            throw new ExecutionException(e.getMessage(), e);
          }
        }
      });

    return debugSession.getRunContentDescriptor();
View Full Code Here

                                                      RunContentDescriptor contentToReuse,
                                                      final ExecutionEnvironment env,
                                                      final Executor executor, String flexSdkName) throws ExecutionException {
    final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
    if (flexSdk == null) {
      throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
    }

    final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null);

    final XDebugSession debugSession =
      XDebuggerManager.getInstance(module.getProject()).startSession(runner, env, contentToReuse, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
          try {
            OpenFLRunningState runningState = new OpenFLRunningState(env, module, true, true);
            final ExecutionResult executionResult = runningState.execute(executor, runner);
            final BCBasedRunnerParameters params = new BCBasedRunnerParameters();
            params.setModuleName(module.getName());
            return new HaxeDebugProcess(session, bc, params);
          }
          catch (IOException e) {
            throw new ExecutionException(e.getMessage(), e);
          }
        }
      });

    return debugSession.getRunContentDescriptor();
View Full Code Here

    final HXCPPRemoteDebugConfiguration configuration = (HXCPPRemoteDebugConfiguration)env.getRunProfile();
    final Module module = configuration.getConfigurationModule().getModule();
    final Executor executor = env.getExecutor();

    if (module == null) {
      throw new ExecutionException(HaxeBundle.message("no.module.for.run.configuration", configuration.getName()));
    }

    final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);

    final boolean notHXCPP = settings.getNmeTarget() != NMETarget.WINDOWS &&
                             settings.getNmeTarget() != NMETarget.MAC &&
                             settings.getNmeTarget() != NMETarget.LINUX &&
                             settings.getNmeTarget() != NMETarget.LINUX64 &&
                             settings.getNmeTarget() != NMETarget.ANDROID &&
                             settings.getNmeTarget() != NMETarget.IOS;
    if (notHXCPP) {
      throw new ExecutionException(HaxeBundle.message("haxe.proper.debug.targets"));
    }

    Integer port = null;
    try {
      port = Integer.parseInt(settings.getHXCPPPort());
    }
    catch (NumberFormatException e) {
      throw new ExecutionException("Bad HXCPP port \"" + settings.getHXCPPPort() + "\" in module settings");
    }

    final int finalPort = port;
    final XDebugSession debugSession =
      XDebuggerManager.getInstance(project).startSession(this, env, contentToReuse, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
          try {
            final HXCPPDebugProcess debugProcess = new HXCPPDebugProcess(session, module, finalPort);
            HXCPPRemoteDebugState runningState = new HXCPPRemoteDebugState(project, env);
            debugProcess.setExecutionResult(runningState.execute(executor, HXCPPRemoteDebugRunner.this));
            return debugProcess;
          }
          catch (IOException e) {
            throw new ExecutionException(e.getMessage(), e);
          }
        }
      });

    return debugSession.getRunContentDescriptor();
View Full Code Here

    final HaxeApplicationConfiguration configuration = (HaxeApplicationConfiguration)env.getRunProfile();
    final Module module = configuration.getConfigurationModule().getModule();
    final Executor executor = env.getExecutor();

    if (module == null) {
      throw new ExecutionException(HaxeBundle.message("no.module.for.run.configuration", configuration.getName()));
    }

    final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);

    final boolean notHXCPP = settings.getNmeTarget() != NMETarget.WINDOWS &&
                             settings.getNmeTarget() != NMETarget.LINUX &&
                             settings.getNmeTarget() != NMETarget.MAC &&
                             settings.getNmeTarget() != NMETarget.LINUX64 &&
                             settings.getNmeTarget() != NMETarget.ANDROID &&
                             settings.getNmeTarget() != NMETarget.IOS;
    if (settings.getHaxeTarget() != HaxeTarget.FLASH && settings.getNmeTarget() != NMETarget.FLASH && notHXCPP) {
      throw new ExecutionException(HaxeBundle.message("haxe.proper.debug.targets"));
    }

    if (settings.isUseNmmlToBuild() && settings.getNmeTarget() != NMETarget.FLASH) {
      boolean runInTest = settings.getNmeTarget() == NMETarget.ANDROID || settings.getNmeTarget() == NMETarget.IOS;
      return runHXCPP(project, module, env, executor, contentToReuse, runInTest);
    }
    // flash only

    final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.intellij.flex"));
    if (plugin == null) {
      throw new ExecutionException(HaxeBundle.message("install.flex.plugin"));
    }
    if (!plugin.isEnabled()) {
      throw new ExecutionException(HaxeBundle.message("enable.flex.plugin"));
    }

    String flexSdkName = settings.getFlexSdkName();
    if (StringUtil.isEmpty(flexSdkName)) {
      throw new ExecutionException(HaxeBundle.message("flex.sdk.not.specified"));
    }

    if (settings.isUseNmmlToBuild() && settings.getNmeTarget() == NMETarget.FLASH) {
      return HaxeFlashDebuggingUtil.getNMEDescriptor(this, module, contentToReuse, env, executor, flexSdkName);
    }
View Full Code Here

    Integer port = null;
    try {
      port = Integer.parseInt(settings.getHXCPPPort());
    }
    catch (NumberFormatException e) {
      throw new ExecutionException("Bad HXCPP port \"" + settings.getHXCPPPort() + "\" in module settings");
    }

    final int finalPort = port;
    final XDebugSession debugSession =
      XDebuggerManager.getInstance(project).startSession(this, env, contentToReuse, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
          try {
            final HXCPPDebugProcess debugProcess = new HXCPPDebugProcess(session, module, finalPort);
            NMERunningState runningState = new NMERunningState(env, module, runInTest);
            debugProcess.setExecutionResult(runningState.execute(executor, HaxeDebugRunner.this));
            return debugProcess;
          }
          catch (IOException e) {
            throw new ExecutionException(e.getMessage(), e);
          }
        }
      });

    return debugSession.getRunContentDescriptor();
View Full Code Here

  }

  private GeneralCommandLine getCommandForNeko(Sdk sdk, HaxeModuleSettings settings) throws ExecutionException {
    final HaxeSdkData sdkData = sdk.getSdkAdditionalData() instanceof HaxeSdkData ? (HaxeSdkData)sdk.getSdkAdditionalData() : null;
    if (sdkData == null) {
      throw new ExecutionException(HaxeCommonBundle.message("invalid.haxe.sdk"));
    }
    final GeneralCommandLine commandLine = new GeneralCommandLine();

    commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath()));
    final String haxelibPath = sdkData.getHaxelibPath();
    if (haxelibPath == null || haxelibPath.isEmpty()) {
      throw new ExecutionException(HaxeCommonBundle.message("no.haxelib.for.sdk", sdk.getName()));
    }
    commandLine.setExePath(haxelibPath);
    commandLine.addParameter("run");
    commandLine.addParameter("nme");
    commandLine.addParameter(myRunInTest ? "test" : "run");
View Full Code Here

  }

  private GeneralCommandLine getCommandForNeko(Sdk sdk, HaxeModuleSettings settings) throws ExecutionException {
    final HaxeSdkData sdkData = sdk.getSdkAdditionalData() instanceof HaxeSdkData ? (HaxeSdkData)sdk.getSdkAdditionalData() : null;
    if (sdkData == null) {
      throw new ExecutionException(HaxeCommonBundle.message("invalid.haxe.sdk"));
    }
    final GeneralCommandLine commandLine = new GeneralCommandLine();

    commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath()));
    final String haxelibPath = sdkData.getHaxelibPath();
    if (haxelibPath == null || haxelibPath.isEmpty()) {
      throw new ExecutionException(HaxeCommonBundle.message("no.haxelib.for.sdk", sdk.getName()));
    }
    commandLine.setExePath(haxelibPath);
    commandLine.addParameter("run");
    commandLine.addParameter("lime");
    commandLine.addParameter(myRunInTest ? "test" : "run");
View Full Code Here

    return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
  }

  private GeneralCommandLine getCommandForNeko(@Nullable HaxeSdkData sdkData, HaxeModuleSettings settings) throws ExecutionException {
    if (sdkData == null || sdkData.getNekoBinPath() == null || sdkData.getNekoBinPath().isEmpty()) {
      throw new ExecutionException(HaxeBundle.message("haxe.run.bad.neko.bin.path"));
    }

    GeneralCommandLine commandLine = new GeneralCommandLine();

    commandLine.setExePath(sdkData.getNekoBinPath());
View Full Code Here

TOP

Related Classes of com.intellij.execution.ExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.