コード例 #1
0
ファイル: UpdaterFrame.java プロジェクト: CaTaHaTa/imagej
  private void filesChangedWorker() {
    // TODO: once this is editable, make sure changes are committed
    fileDetails.reset();
    for (final FileObject file : table.getSelectedFiles()) fileDetails.showFileDetails(file);
    if (fileDetails.getDocument().getLength() > 0 && table.areAllSelectedFilesUploadable())
      fileDetails.setEditableForDevelopers();

    for (final FileAction button : fileActions) button.enableIfValid();

    apply.setEnabled(files.hasChanges());
    cancel.setText(files.hasChanges() ? "Cancel" : "Close");

    if (files.hasUploadableSites()) enableUploadOrNot();

    int install = 0, uninstall = 0, upload = 0;
    long bytesToDownload = 0, bytesToUpload = 0;

    for (final FileObject file : files)
      switch (file.getAction()) {
        case INSTALL:
        case UPDATE:
          install++;
          bytesToDownload += file.filesize;
          break;
        case UNINSTALL:
          uninstall++;
          break;
        case UPLOAD:
          upload++;
          bytesToUpload += file.filesize;
          break;
      }
    int implicated = 0;
    final DependencyMap map = files.getDependencies(true);
    for (final FileObject file : map.keySet()) {
      implicated++;
      bytesToUpload += file.filesize;
    }
    String text = "";
    if (install > 0)
      text +=
          " install/update: "
              + install
              + (implicated > 0 ? "+" + implicated : "")
              + " ("
              + sizeToString(bytesToDownload)
              + ")";
    if (uninstall > 0) text += " uninstall: " + uninstall;
    if (files.hasUploadableSites() && upload > 0)
      text += " upload: " + upload + " (" + sizeToString(bytesToUpload) + ")";
    fileSummary.setText(text);
  }