Ejemplo n.º 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);
  }
Ejemplo n.º 2
0
  public DetailPanel(
      Composite composite, int style, HistoryModel historyModel, HistoryDialog historyDialog) {
    super(composite, style);

    this.setBackgroundImage(null);
    this.setBackgroundMode(SWT.INHERIT_DEFAULT);

    this.historyModel = historyModel;
    this.historyDialog = historyDialog;

    this.pendingRestoreRequest = null;
    this.pendingLsFolderRequests = Maps.newConcurrentMap();
    this.eventBus = GuiEventBus.getAndRegister(this);

    this.restoreStatusIconComposite = null;
    this.restoreStatusTextLabel = null;
    this.restoreButton = null;
    this.historyTable = null;

    this.createContents();
  }
Ejemplo n.º 3
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);
  }