Exemplo n.º 1
0
  private void controlConnectAction() {
    if (robot == null) {
      assert (display.connectButton.getText().equals("connect"));
    } else {
      assert (display.connectButton.getText().equals("disconnect"));
      Debug.info("trying to kill %s", robot);

      final RobotConnection _robot = robot;
      Center.addEvent(
          new Center.EventRunnable() {
            @Override
            protected void run() {
              _robot.kill();
            }
          });

      return;
    }

    String address = (String) display.robotAddressBox.getSelectedItem();
    if (address == null) {
      ToolMessage.displayError("choose valid address");
      return;
    }

    address = address.trim();

    if (display.localCheckBox.isSelected() && !address.endsWith(".local")) {
      address += ".local";
    }

    display.connectButton.setEnabled(false);
    Center.addEvent(new ControlConnectRunnable(address));
  }
Exemplo n.º 2
0
  @Override
  public void actionPerformed(ActionEvent e) {

    String suggest = null;
    if (group.source == Group.GroupSource.ROBOT_STREAM) {
      String rname = null;
      boolean same = true;

      for (LogReference ref : group.logs) {
        if (rname == null) {
          rname = ref.host_name;
        } else {
          if (!rname.equals(ref.host_name)) {
            same = false;
            break;
          }
        }
      }

      suggest = (same && rname != null) ? PathChooser.suggestion(rname) : null;
    }

    Path path = PathChooser.chooseDirPath(this, suggest);

    if (path != null) {
      for (LogReference ref : group.logs) {
        Debug.info("writing log r%d to %s", ref.thisID, path);
        ref.copyLogToPath(path);
      }
    }
  }