Exemplo n.º 1
0
  @Override
  @SuppressWarnings("boxing")
  public void run() {
    do {
      try {
        final int v = process.waitFor();
        final String msg = String.format("Backend '%s' terminated with exit code %d.", nodeName, v);

        String report = null;
        if (shouldCreateReport(v)) {
          ErlLogger.error(msg);
          report = createReport(v, msg);
          final String reportMsg =
              report != null
                  ? "\n\n"
                      + "An error log has been created at "
                      + report
                      + ".\nPlease report the problem so that we can fix it."
                  : "";
          final String bigMsg =
              msg
                  + "\n\n"
                  + "This error is not recoverable, please restart your Eclipse instance."
                  + reportMsg;
          MessageReporter.showError(bigMsg, ReporterPosition.MODAL);
        } else {
          ErlLogger.info(msg);
        }
        // FIXME backend.setExitStatus(v);
        return;
      } catch (final InterruptedException e) {
      }
    } while (true);
  }
Exemplo n.º 2
0
  @Override
  public IBackend createBackend(final BackendData data) {
    ErlLogger.debug("Create backend " + data.getNodeName());
    if (!data.isManaged() && !data.isAutostart()) {
      ErlLogger.info("Not creating backend for %s", data.getNodeName());
      return null;
    }

    final IBackend b;
    final String erlangHostName = HostnameUtils.getErlangHostName(data.isLongName());
    try {
      String nodeName = data.getNodeName();
      final boolean hasHost = nodeName.contains("@");
      nodeName = hasHost ? nodeName : nodeName + "@" + erlangHostName;
      ILaunch launch = data.getLaunch();
      if (launch == null) {
        launch = launchPeer(data);
      }
      final IProcess mainProcess =
          launch.getProcesses().length == 0 ? null : launch.getProcesses()[0];
      final IErlRuntime runtime =
          new ErlRuntime(
              nodeName, data.getCookie(), mainProcess, !data.isTransient(), data.isLongName());
      b =
          data.isInternal()
              ? new InternalBackend(data, runtime)
              : new ExternalBackend(data, runtime);
      b.initialize();
      return b;
    } catch (final BackendException e) {
      e.printStackTrace();
    }
    return null;
  }
Exemplo n.º 3
0
 private Set<String> getResourcesToBuild(
     final int kind, @SuppressWarnings("rawtypes") final Map args, final IProject project)
     throws CoreException {
   Set<BuildResource> result = Sets.newHashSet();
   final IProgressMonitor submon = new NullProgressMonitor();
   // new SubProgressMonitor(monitor, 10);
   submon.beginTask("retrieving resources to build", IProgressMonitor.UNKNOWN);
   if (kind == FULL_BUILD) {
     result = helper.getAffectedResources(args, project, submon);
   } else {
     final IResourceDelta delta = getDelta(project);
     final Path path = new Path(".settings/org.erlide.core.prefs");
     if (delta.findMember(path) != null) {
       ErlLogger.info("project configuration changed: doing full rebuild");
       result = helper.getAffectedResources(args, project, submon);
     } else {
       result = helper.getAffectedResources(args, delta, submon);
     }
   }
   if (BuilderHelper.isDebugging()) {
     ErlLogger.debug(
         "Will compile %d resource(s): %s", Integer.valueOf(result.size()), result.toString());
   }
   submon.done();
   final Set<String> paths = new HashSet<String>();
   for (final BuildResource res : result) {
     paths.add(res.getResource().getLocation().toPortableString());
   }
   return paths;
 }