Ejemplo n.º 1
0
 private void updateErrors() {
   if ((currentOperator != null) && onlyCurrent.isSelected()) {
     fill(currentOperator);
   } else {
     if (currentProcess != null) {
       fill(currentProcess.getRootOperator());
     }
   }
 }
Ejemplo n.º 2
0
  public static void createBugReport(
      File reportFile,
      Throwable exception,
      String userMessage,
      Process process,
      String logMessage,
      File[] attachments)
      throws IOException {
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(reportFile));
    zipOut.setComment("RapidMiner bug report - generated " + new Date());
    write("message.txt", "User message", userMessage, zipOut);
    write("_process.xml", "Process as in memory.", process.getRootOperator().getXML(false), zipOut);
    if (process.getProcessLocation() != null) {
      try {
        String contents = process.getProcessLocation().getRawXML();
        write(
            process.getProcessLocation().getShortName(),
            "Raw process file in repository.",
            contents,
            zipOut);
      } catch (Throwable t) {
        write(
            process.getProcessLocation().getShortName(),
            "Raw process file in repository.",
            "could not read: " + t,
            zipOut);
      }
    }
    write("_log.txt", "Log message", logMessage, zipOut);
    write(
        "_properties.txt",
        "System properties, information about java version and operating system",
        getProperties(),
        zipOut);
    write("_exception.txt", "Exception stack trace", getStackTrace(exception), zipOut);

    for (File attachment : attachments) {
      writeFile(attachment, zipOut);
    }
    zipOut.close();
  }
Ejemplo n.º 3
0
 public Operator getRootOperator() {
   if (process != null) {
     return process.getRootOperator();
   }
   return null;
 }
  /**
   * Displays a warning bubble that alerts the user that he failed to connect any of the process
   * result ports.
   *
   * <p>The bubble is located at the first result port of the outermost process and the process view
   * will change to said port. The {@link ResultWarningPreventionRegistry} contains a list with
   * Operators which can suppress this warning.
   *
   * @param process the process in question
   * @return the {@link PortInfoBubble} instance, never {@code null}
   */
  public static PortInfoBubble displayPrecheckNoResultPortInformation(final Process process) {
    if (process == null) {
      throw new IllegalArgumentException("port must not be null!");
    }

    Port firstResultPort =
        process.getRootOperator().getSubprocess(0).getInnerSinks().getPortByIndex(0);
    JButton ackButton =
        new JButton(I18N.getGUIMessage("gui.bubble.process_unconnected_result_port.button.label"));
    ackButton.setToolTipText(
        I18N.getGUIMessage("gui.bubble.process_unconnected_result_port.button.tip"));

    final BubbleDelegator bubbleDelegator = new BubbleDelegator();
    ResourceAction runAnywayAction =
        new ResourceAction("process_unconnected_result_port.button_run_anyway", "F11") {

          private static final long serialVersionUID = 1L;

          @Override
          public void actionPerformed(final ActionEvent e) {
            BubbleWindow bubble = bubbleDelegator.getBubble();
            if (bubble != null) {
              bubble.killBubble(true);
            }

            // run process without checking for problems
            RapidMinerGUI.getMainFrame().runProcess(false);
          }
        };
    LinkButton runAnywayButton = new LinkButton(runAnywayAction);
    runAnywayButton.setToolTipText(
        I18N.getGUIMessage("gui.bubble.process_unconnected_result_port.button_run_anyway.tip"));
    runAnywayButton.registerKeyboardAction(
        runAnywayAction,
        KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0),
        JComponent.WHEN_IN_FOCUSED_WINDOW);

    PortBubbleBuilder builder =
        new PortBubbleBuilder(
            RapidMinerGUI.getMainFrame(), firstResultPort, "process_unconnected_result_port");
    final PortInfoBubble noResultConnectionBubble =
        builder
            .setHideOnConnection(true)
            .setAlignment(AlignedSide.LEFT)
            .setStyle(BubbleStyle.WARNING)
            .setHideOnProcessRun(false)
            .setEnsureVisible(true)
            .hideCloseButton()
            .setAdditionalComponents(new JComponent[] {ackButton, runAnywayButton})
            .build();
    ackButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            noResultConnectionBubble.killBubble(true);
          }
        });
    bubbleDelegator.setBubbleWindow(noResultConnectionBubble);

    noResultConnectionBubble.setVisible(true);
    return noResultConnectionBubble;
  }