private void filter() { controller.background(new WorkerBackgroundAction<Map<TransferItem, TransferStatus>>(controller, source, new TransferPromptFilterWorker(transfer, action, cache, controller) { @Override public void cleanup(final Map<TransferItem, TransferStatus> accepted) { status = accepted; controller.reload(); } } ) ); }
@Override public void callback(final Path folder, final String region) { background(new WorkerBackgroundAction<Path>(BrowserController.this, pool, new CreateDirectoryWorker(folder, region) { @Override public void cleanup(final Path folder) { reload(workdir(), Collections.singletonList(folder), Collections.singletonList(folder)); } })); } });
@Override public void callback(final boolean edit, final Path file) { background(new WorkerBackgroundAction<Path>(BrowserController.this, pool, new TouchWorker(file) { @Override public void cleanup(final Path folder) { reload(workdir(), Collections.singletonList(file), Collections.singletonList(file)); if(edit) { file.attributes().setSize(0L); edit(file); } } })); }
@Override public void callback(int returncode) { if(returncode == DEFAULT_OPTION) { // Delay render until path is cached in the background background(new WorkerBackgroundAction<AttributedList<Path>>(BrowserController.this, pool, new SearchWorker(workdir, filenameFilter, cache, listener) { @Override public void cleanup(final AttributedList<Path> list) { super.cleanup(list); // Set filter with search result setFilter(new RecursiveSearchFilter(list)); // Reload browser reload(); } }) ); } } });
public void revert(final List<Path> files) { parent.background(new WorkerBackgroundAction<List<Path>>(parent, parent.getSession(), new RevertWorker(files) { @Override public void cleanup(final List<Path> result) { parent.reload(parent.workdir(), files, files); } } )); } }
public void callback(final Path selected, final Path link) { background(new WorkerBackgroundAction<Path>(BrowserController.this, pool, new CreateSymlinkWorker(link, selected.getName()) { @Override public void cleanup(final Path symlink) { reload(workdir(), Collections.singletonList(symlink), Collections.singletonList(symlink)); } })); } });
@Override public void fileCreated(final Local file) { if(log.isInfoEnabled()) { log.info(String.format("File %s created", file)); } controller.background(new WorkerBackgroundAction<Transfer>(controller, session, editor.save(new DisabledTransferErrorCallback())) ); } }
@Override public void fileWritten(final Local file) { if(log.isInfoEnabled()) { log.info(String.format("File %s written", file)); } controller.background(new WorkerBackgroundAction<Transfer>(controller, session, editor.save(new DisabledTransferErrorCallback())) ); }
/** * Updates the size field by iterating over all files and * reading the cached size value in the attributes of the path */ private void initSize() { if(this.toggleSizeSettings(false)) { controller.background(new WorkerBackgroundAction<Long>(controller, session, new ReadSizeWorker(files) { @Override public void cleanup(final Long size) { setSize(size); toggleSizeSettings(true); } } )); } }
@Override public void callback(final Path folder, final String region, final VaultCredentials passphrase) { background(new WorkerBackgroundAction<Path>(BrowserController.this, pool, new CreateVaultWorker(region, passphrase, PasswordStoreFactory.get(), VaultFactory.get(folder, DefaultVaultRegistry.DEFAULT_MASTERKEY_FILE_NAME, DefaultVaultRegistry.DEFAULT_PEPPER)) { @Override public void cleanup(final Path vault) { reload(workdir(), Collections.singletonList(folder), Collections.singletonList(folder)); } }) ); } });
private void run(final List<Path> files) { parent.background(new WorkerBackgroundAction<List<Path>>(parent, parent.getSession(), new DeleteWorker(LoginCallbackFactory.get(parent), files, parent.getCache(), parent) { @Override public void cleanup(final List<Path> deleted) { super.cleanup(deleted); parent.reload(parent.workdir(), files, Collections.emptyList()); } } ) ); } }
@Action public void calculateSizeButtonClicked(final ID sender) { if(this.toggleSizeSettings(false)) { controller.background(new WorkerBackgroundAction<Long>(controller, session, new CalculateSizeWorker(files, controller) { @Override public void cleanup(final Long size) { setSize(size); toggleSizeSettings(true); } @Override protected void update(final long size) { invoke(new WindowMainAction(InfoController.this) { @Override public void run() { setSize(size); } }); } } )); } }
@Action public void bucketTransferAccelerationButtonClicked(final NSButton sender) { if(this.toggleS3Settings(false)) { controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new WriteTransferAccelerationWorker(files, bucketTransferAccelerationButton.state() == NSCell.NSOnState) { @Override public void cleanup(final Boolean done) { super.cleanup(done); toggleS3Settings(true); initS3(); } } ) ); } }
private void aclInputDidEndEditing() { if(this.toggleAclSettings(false)) { controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new WriteAclWorker(files, new Acl(acl.toArray(new Acl.UserAndRole[acl.size()])), new PromptRecursiveCallback<Acl>(this), controller) { @Override public void cleanup(final Boolean v) { toggleAclSettings(true); initAcl(); } } ) ); } }
private void metadataInputDidEndEditing() { if(toggleMetadataSettings(false)) { final Map<String, String> update = new HashMap<String, String>(); for(Header header : metadata) { update.put(header.getName(), header.getValue()); } controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new WriteMetadataWorker(files, update, new PromptRecursiveCallback<String>(this), controller) { @Override public void cleanup(final Boolean v) { toggleMetadataSettings(true); initMetadata(); } } ) ); } }
/** * */ private void initPermissions() { permissionsField.setStringValue(LocaleFactory.localizedString("Unknown")); // Disable Apply button and start progress indicator if(this.togglePermissionSettings(false)) { controller.background(new WorkerBackgroundAction<PermissionOverwrite>(controller, session, new ReadPermissionWorker(files) { @Override public void cleanup(final PermissionOverwrite permissions) { setPermissions(permissions); togglePermissionSettings(true); } } )); } }
/** * Read custom metadata HTTP headers from cloud provider */ private void initMetadata() { this.setMetadata(Collections.emptyList()); if(this.toggleMetadataSettings(false)) { controller.background(new WorkerBackgroundAction<Map<String, String>>(controller, session, new ReadMetadataWorker(files) { @Override public void cleanup(final Map<String, String> updated) { final List<Header> m = new ArrayList<Header>(); if(updated != null) { for(Map.Entry<String, String> key : updated.entrySet()) { m.add(new Header(key.getKey(), key.getValue())); } } setMetadata(m); toggleMetadataSettings(true); } } )); } }
@Action public void bucketAnalyticsButtonClicked(final NSButton sender) { if(this.toggleS3Settings(false)) { final boolean enabled = bucketAnalyticsButton.state() == NSCell.NSOnState; final String document = preferences.getProperty("analytics.provider.qloudstat.iam.policy"); controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new WriteIdentityWorker(prompt, enabled, document) { @Override public void cleanup(final Boolean done) { toggleS3Settings(true); initS3(); } })); } }
@Action public void distributionAnalyticsButtonClicked(final NSButton sender) { if(this.toggleDistributionSettings(false)) { final boolean enabled = distributionAnalyticsButton.state() == NSCell.NSOnState; final String document = preferences.getProperty("analytics.provider.qloudstat.iam.policy"); controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new WriteIdentityWorker(prompt, enabled, document) { @Override public void cleanup(final Boolean result) { toggleDistributionSettings(true); initDistribution(); } })); } }
@Action public void distributionInvalidateObjectsButtonClicked(final ID sender) { if(this.toggleDistributionSettings(false)) { final Distribution.Method method = Distribution.Method.forName(distributionDeliveryPopup.selectedItem().representedObject()); controller.background(new WorkerBackgroundAction<Boolean>(controller, session, new DistributionPurgeWorker(files, prompt, method) { @Override public void cleanup(final Boolean result) { // Refresh the current distribution status distributionStatusButtonClicked(sender); } })); } }