@Override
  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    try {
      monitor.setTaskName("Retrieving LOG file for procedure " + m_proc.getProcName());

      IFileManager fileMgr = (IFileManager) ServiceManager.get(IFileManager.class);
      String path =
          fileMgr.getServerFilePath(m_proc.getProcId(), ServerFileType.EXECUTOR_LOG, monitor);
      Logger.debug("LOG file path: '" + path + "'", Level.PROC, this);

      logFile = (LogFile) fileMgr.getServerFile(path, ServerFileType.EXECUTOR_LOG, null, monitor);

      List<IServerFileLine> lines = logFile.getLines();

      monitor.beginTask("Exporting log data", lines.size());

      PrintWriter writer =
          new PrintWriter(new OutputStreamWriter(new FileOutputStream(m_destinationFileName)));
      for (IServerFileLine line : lines) {
        writer.println(line.toString());
        monitor.worked(1);
        if (monitor.isCanceled()) break;
      }
      writer.close();
      monitor.done();
      result = CommandResult.SUCCESS;
    } catch (Exception e) {
      Logger.error("Could retrieve LOG:" + e.getLocalizedMessage(), Level.PROC, this);
    }
    monitor.done();
  }
示例#2
0
  /**
   * ************************************************************************* Setup combo options
   * ************************************************************************
   */
  private boolean setupComboOptions(
      Vector<String> options, Vector<String> expectedValues, String defaultOption) {
    boolean defaultOptionSet = false;

    m_optionsCombo = new Combo(m_optionContainer, SWT.DROP_DOWN | SWT.READ_ONLY);
    m_optionsCombo.setData("IDs", expectedValues);
    m_optionsCombo.addKeyListener(this);
    m_optionsCombo.addSelectionListener(this);

    String s = ""; // expected value

    for (String option : options) {
      try {
        s = option.substring(option.indexOf(KEY_SEPARATOR) + 1, option.length());
        m_optionsCombo.add(s);

      } catch (Exception ex) {
        ex.printStackTrace();
        Logger.error(
            "Error processing combo options: " + ex.getLocalizedMessage(), Level.GUI, this);
        m_optionsCombo.add("???");
      }
    } // for
    try {
      if (!defaultOption.isEmpty()) {
        int idx = expectedValues.indexOf(defaultOption);
        m_optionsCombo.select(idx);
        defaultOptionSet = true;
        m_selectedOption = idx;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      Logger.error(
          "Error processing default combo option: " + ex.getLocalizedMessage(), Level.GUI, this);
    }
    return defaultOptionSet;
  }
示例#3
0
  /**
   * ************************************************************************* Setup radio options
   * ************************************************************************
   */
  private boolean setupRadioOptions(
      Vector<String> options, Vector<String> expectedValues, String defaultOption) {
    int count = 0;
    boolean defaultOptionSet = false;
    for (String option : options) {
      try {
        String expected = "";
        if (expectedValues.size() > count) {
          expected = expectedValues.elementAt(count);
        }

        Button b = new Button(m_optionContainer, SWT.RADIO);
        b.setFont(m_myFont);
        String value = option.substring(option.indexOf(KEY_SEPARATOR) + 1, option.length());
        // Take into account the LIST|ALPHA case. When keys are the same
        // as values,
        // we do not want to display it twice.
        if (!expected.isEmpty() && !expected.equals(value)) {
          b.setText(expected + " : " + value);
        } else {
          b.setText(value);
        }

        if (!defaultOption.isEmpty() && (expected.equals(defaultOption))) {
          b.setSelection(true);
          defaultOptionSet = true;
          m_selectedOption = count;
        } else {
          b.setSelection(false);
        }
        b.setData("ID", count);
        b.addKeyListener(this);
        b.addSelectionListener(this);
        m_optionsRadio.add(b);
      } catch (Exception ex) {
        ex.printStackTrace();
        Logger.error(
            "Error processing prompt radio options: " + ex.getLocalizedMessage(), Level.GUI, this);
      }
      count++;
    }
    return defaultOptionSet;
  }