public void widgetSelected(SelectionEvent e) { TableItem[] items = table.getSelection(); GregorianCalendar first = null; GregorianCalendar last = null; for (int i = 0; i < items.length; i++) { File f = (File) items[i].getData(); Manifest mf = null; try { mf = ArchiveManifestCache.getInstance() .getManifest( (AbstractIncrementalFileSystemMedium) Application.getInstance().getCurrentTarget().getMedium(), f); } catch (ApplicationException e1) { Application.getInstance().handleException(e1); } if (mf != null && mf.getDate() != null) { GregorianCalendar date = mf.getDate(); if (first == null || date.before(first)) { first = date; } if (last == null || date.after(last)) { last = date; } } } Application.getInstance().setCurrentDates(first, last); }
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(); } */ }
private void initText(TableItem item, int column, Manifest manifest) { if (manifest == null || manifest.getTitle() == null || manifest.getTitle().trim().length() == 0) { item.setForeground(column, Colors.C_LIGHT_GRAY); item.setText(column, ResourceManager.instance().getLabel("mainpanel.nodesc.label")); } else { item.setForeground(column, Colors.C_BLACK); item.setText(column, manifest.getTitle()); } }