Logo Search packages:      
Sourcecode: aspectj version File versions

LangUtil.ProcessController org::aspectj::ajde::Ajde::runInNewVM (  )  [inline]

Utility to run the project main class from the project properties in a new VM. Errors are logged to the ErrorHandler.

Returns:
LangUtil.ProcessController running with process, or null if unable to start

Definition at line 192 of file Ajde.java.

References org::aspectj::ajde::Ajde::RunProperties::args, org::aspectj::ajde::Ajde::RunProperties::classpath, org::aspectj::ajde::core::IBuildMessageHandler::handleMessage(), org::aspectj::ajde::Ajde::RunProperties::mainClass, and org::aspectj::ajde::Ajde::RunProperties::valid.

                                                     {
            final RunProperties props = new RunProperties(compilerConfig, runtimeProperties, uiBuildMsgHandler, rootFrame);
            if (!props.valid) {
                  return null; // error already handled
            }
            // setup to run asynchronously, pipe streams through, and report errors
            final StringBuffer command = new StringBuffer();
            LangUtil.ProcessController controller = new LangUtil.ProcessController() {
                  public void doCompleting(Throwable thrown, int result) {
                        LangUtil.ProcessController.Thrown any = getThrown();
                        if (!any.thrown && (null == thrown) && (0 == result)) {
                              return; // no errors
                        }
                        // handle errors
                        String context = props.mainClass + " command \"" + command + "\"";
                        if (null != thrown) {
                              String m = "Exception running " + context;
                              uiBuildMsgHandler.handleMessage(new Message(m, IMessage.ERROR, thrown, null));
                        } else if (0 != result) {
                              String m = "Result of running " + context;
                              uiBuildMsgHandler.handleMessage(new Message(m, IMessage.ERROR, null, null));
                        }
                        if (null != any.fromInPipe) {
                              String m = "Error processing input pipe for " + context;
                              uiBuildMsgHandler.handleMessage(new Message(m, IMessage.ERROR, thrown, null));
                        }
                        if (null != any.fromOutPipe) {
                              String m = "Error processing output pipe for " + context;
                              uiBuildMsgHandler.handleMessage(new Message(m, IMessage.ERROR, thrown, null));
                        }
                        if (null != any.fromErrPipe) {
                              String m = "Error processing error pipe for " + context;
                              uiBuildMsgHandler.handleMessage(new Message(m, IMessage.ERROR, thrown, null));
                        }
                  }
            };

            controller = LangUtil.makeProcess(controller, props.classpath, props.mainClass, props.args);

            command.append(Arrays.asList(controller.getCommand()).toString());

            // now run the process
            controller.start();
            return controller;
      }


Generated by  Doxygen 1.6.0   Back to index