コード例 #1
0
  private void restoreFileVersion(FileVersion fileVersion) {
    // Set labels/status
    String shortFileName = shortenFileName(fileVersion.getPath());
    String versionStr = Long.toString(fileVersion.getVersion());

    restoreButton.setEnabled(false);
    restoreStatusIconComposite.setVisible(true);
    restoreStatusTextLabel.setVisible(true);

    restoreStatusIconComposite.setAnimatedImage(
        IMAGE_LOADING_SPINNER_RESOURCE, IMAGE_LOADING_SPINNER_FRAME_RATE);
    restoreStatusTextLabel.setText(
        I18n.getText(
            "org.syncany.gui.history.DetailPanel.label.fileRestoreOngoing",
            shortFileName,
            versionStr));
    restoreStatusTextLabel.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_ARROW));
    restoreStatusTextLabel.setToolTipText("");

    restoredFile = null;

    layout();

    // Send restore request
    RestoreOperationOptions restoreOptions = new RestoreOperationOptions();
    restoreOptions.setFileHistoryId(fileVersion.getFileHistoryId());
    restoreOptions.setFileVersion(fileVersion.getVersion().intValue());

    pendingRestoreRequest = new RestoreFolderRequest();
    pendingRestoreRequest.setRoot(historyModel.getSelectedRoot());
    pendingRestoreRequest.setOptions(restoreOptions);

    eventBus.post(pendingRestoreRequest);
  }
コード例 #2
0
  private void sendLsFolderRequest(String root, FileHistoryId fileHistoryId) {
    // Create list request
    LsOperationOptions lsOptions = new LsOperationOptions();

    lsOptions.setPathExpression(fileHistoryId.toString());
    lsOptions.setFileHistoryId(true);
    lsOptions.setRecursive(false);
    lsOptions.setDeleted(true);
    lsOptions.setFetchHistories(true);
    lsOptions.setFileTypes(Sets.newHashSet(FileType.FILE, FileType.SYMLINK));

    LsFolderRequest lsRequest = new LsFolderRequest();

    lsRequest.setRoot(root);
    lsRequest.setOptions(lsOptions);

    logger.log(
        Level.INFO,
        "Detail panel: Sending LsRequest with ID #" + lsRequest.getId() + " for " + root + " ...");

    // Send request
    pendingLsFolderRequests.put(lsRequest.getId(), lsRequest);
    eventBus.post(lsRequest);
  }