コード例 #1
0
  private void fillTargetData(AbstractTarget target) {
    AbstractIncrementalFileSystemMedium medium =
        (AbstractIncrementalFileSystemMedium) target.getMedium();
    File[] archives = new File[0];
    try {
      Logger.defaultLogger()
          .info(
              "Looking for archives in "
                  + medium.getFileSystemPolicy().getDisplayableParameters(true),
              "Physical View");
      archives = medium.listArchives(null, null, true);
    } catch (Throwable e) {
      this.application.handleException(e);
    }

    if (archives == null) {
      archives = new File[0];
    }

    medium.checkArchivesEncoding(archives);

    for (int i = archives.length - 1; i >= 0; i--) {
      TableItem item = new TableItem(table, SWT.NONE);
      item.setData(archives[i]);

      try {
        Manifest manifest = ArchiveManifestCache.getInstance().getManifest(medium, archives[i]);

        String prp = null;
        if (manifest != null) {
          item.setText(1, Utils.formatDisplayDate(manifest.getDate()));
          initText(item, 0, manifest);
          prp = manifest.getStringProperty(ManifestKeys.OPTION_BACKUP_SCHEME);
        }

        if ((prp != null && prp.equals(AbstractTarget.BACKUP_SCHEME_FULL)) || i == 0) {
          item.setImage(0, ArecaImages.ICO_FS_FOLDER_FULL);
        } else if (prp != null && prp.equals(AbstractTarget.BACKUP_SCHEME_DIFFERENTIAL)) {
          item.setImage(0, ArecaImages.ICO_FS_FOLDER_DIFFERENTIAL);
        } else {
          item.setImage(0, ArecaImages.ICO_FS_FOLDER);
        }
        initSize(item, 2, archives[i], medium);
      } catch (ApplicationException e) {
        application.handleException(e);
      }
    }

    /*
    if (archives.length == 0) {
    	showViewMessage();
    } else {
    	removeViewMessage();
    }
    */
  }
コード例 #2
0
  private void initSize(
      TableItem item, int column, File archive, AbstractIncrementalFileSystemMedium medium)
      throws ApplicationException {
    long prp = medium.getArchiveSize(archive, false);

    if (prp >= 0) {
      item.setForeground(column, Colors.C_BLACK);
      item.setText(column, Utils.formatFileSize(prp));
    } else {
      item.setForeground(column, Colors.C_LIGHT_GRAY);
      item.setText(column, ResourceManager.instance().getLabel("mainpanel.nosize.label"));
    }
  }