private Image getStatusImage(FileStatus status) { switch (status) { case NEW: return SWTResourceManager.getImage(String.format(IMAGE_RESOURCE_FORMAT, "add")); case CHANGED: case RENAMED: return SWTResourceManager.getImage(String.format(IMAGE_RESOURCE_FORMAT, "edit")); case DELETED: return SWTResourceManager.getImage(String.format(IMAGE_RESOURCE_FORMAT, "delete")); default: return null; } }
private void updateRestoreStatus( RestoreFolderRequest restoreRequest, RestoreFolderResponse restoreResponse) { RestoreOperationResult restoreResult = restoreResponse.getResult(); RestoreResultCode restoreResultCode = restoreResult.getResultCode(); // Set labels/status restoreButton.setEnabled(true); restoreStatusIconComposite.setVisible(true); restoreStatusTextLabel.setVisible(true); if (restoreResultCode == RestoreResultCode.ACK) { String shortFileName = shortenFileName(restoreResult.getTargetFile().getAbsolutePath()); logger.log( Level.INFO, "Detail panel: Restore successful, file restored to " + restoreResult.getTargetFile().toString()); restoreStatusIconComposite.setImage( SWTResourceManager.getImage(String.format(IMAGE_RESOURCE_FORMAT, "success"))); restoreStatusTextLabel.setText( I18n.getText( "org.syncany.gui.history.DetailPanel.label.fileRestoreSuccess", shortFileName)); restoreStatusTextLabel.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_HAND)); restoreStatusTextLabel.setToolTipText(restoreResult.getTargetFile().toString()); restoredFile = restoreResult.getTargetFile(); } else { logger.log(Level.WARNING, "Detail panel: Restore FAILED, error code " + restoreResultCode); restoreStatusIconComposite.setImage( SWTResourceManager.getImage(String.format(IMAGE_RESOURCE_FORMAT, "failure"))); restoreStatusTextLabel.setText( I18n.getText("org.syncany.gui.history.DetailPanel.label.fileRestoreFailure")); restoreStatusTextLabel.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_ARROW)); restoreStatusTextLabel.setToolTipText(""); restoredFile = null; } layout(); }