Ejemplo n.º 1
0
  public void setTask(int template, String task[]) {
    if (m_monitor != null) {
      switch (template) {
        case TASK_CONNECT:
          m_monitor.setTaskName("Connecting to SFTP Site");
          break;

        case TASK_SCANNING:
          m_monitor.setTaskName("Scanning directories");
          break;

        case TASK_TRANSFER:
          if (task.length == 2) {
            m_monitor.setTaskName(task[0] + ":\t" + task[1]);
          }
          break;

        case TASK_COMPLETE:
          m_monitor.setTaskName("Transfer completed");
          break;

        case TASK_ERROR:
          if (task.length >= 1) {
            m_monitor.setTaskName("ERROR: " + task[0]);
            for (int a = 0; a < task.length; a++) {
              m_output.append(task[a] + "\n");
              System.out.println(task[a]);
            }
          }
          break;
      }
    }
  }
  private IStatus calculateStatus(IRefreshEvent event) {
    StringBuffer text = new StringBuffer();
    int code = IStatus.OK;
    int changeCount = event.getChangeDescription().getChangeCount();
    int numChanges = getChangeCount();
    if (numChanges > 0) {
      code = IRefreshEvent.STATUS_CHANGES;

      int incomingChanges = getIncomingChangeCount();
      String numIncomingChanges =
          incomingChanges == 0
              ? "" //$NON-NLS-1$
              : NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_incomingChanges,
                  Integer.toString(incomingChanges));

      int outgoingChanges = getOutgoingChangeCount();
      String numOutgoingChanges =
          outgoingChanges == 0
              ? "" //$NON-NLS-1$
              : NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_outgoingChanges,
                  Integer.toString(outgoingChanges));

      String sep =
          incomingChanges > 0 && outgoingChanges > 0 ? "; " : ""; // $NON-NLS-1$ //$NON-NLS-2$

      if (changeCount > 0) {
        // New changes found
        code = IRefreshEvent.STATUS_NEW_CHANGES;
        String numNewChanges = Integer.toString(changeCount);
        if (changeCount == 1) {
          text.append(
              NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_newChangesSingular,
                  (new Object[] {
                    getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges
                  })));
        } else {
          text.append(
              NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_newChangesPlural,
                  (new Object[] {
                    getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges
                  })));
        }
      } else {
        // Refreshed resources contain changes
        if (numChanges == 1) {
          text.append(
              NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_changesSingular,
                  (new Object[] {
                    getName(), new Integer(numChanges), numIncomingChanges, sep, numOutgoingChanges
                  })));
        } else {
          text.append(
              NLS.bind(
                  TeamUIMessages.RefreshCompleteDialog_changesPlural,
                  (new Object[] {
                    getName(), new Integer(numChanges), numIncomingChanges, sep, numOutgoingChanges
                  })));
        }
      }
    } else {
      // No changes found
      code = IRefreshEvent.STATUS_NO_CHANGES;
      text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_6, new String[] {getName()}));
    }
    return new Status(IStatus.OK, TeamUIPlugin.ID, code, text.toString(), null);
  }
Ejemplo n.º 3
0
 public String getTransferOuput() {
   return m_output.toString();
 }