/** * Currently indeterminate task can be switched to show percentage completed. * @param workunits workunits total number of workunits that will be processed */ @Override public void switchToDeterminate(int workunits) { if (handle != null) { if (started) { this.progressTotal = workunits; handle.switchToDeterminate(100); } else { start(workunits); } } }
/** * Currently indeterminate task can be switched to show percentage completed. * A common use case is to calculate the amount of work in the beginning showing * in indeterminate mode and later switch to the progress with known steps */ public void switchToDeterminate(int maxWorkUnits) { synchronized (handle) { if( ! started || cancelled) { return; } if (!determinate) { this.maxWorkUnits = maxWorkUnits; addedAfterStartParsing = 0; if (problemDetector != null) { problemDetector.switchToDeterminate(maxWorkUnits); } handle.switchToDeterminate(ALL_WORK_INT); determinate = true; } } }
@Override public void operationFinish(Operation operation, Collection<TransferFile> forFiles) { operations.pollFirst(); if (operation == Operation.LIST) { progressHandle.switchToDeterminate(workUnits); progressHandle.progress(workUnit); } if (operations.isEmpty()) { progressHandle.finish(); } }
@Override public void addUnits(Collection<TransferFile> files) { progressHandle.switchToIndeterminate(); workUnits += getWorkUnits(files); progressHandle.switchToDeterminate(workUnits); }
public @Override void transferStarted(TransferEvent e) { checkCancel(); long contentLength = e.getResource().getContentLength(); LOG.log(Level.FINE, "contentLength: {0}", contentLength); // #189806: could be resumed due to FNFE in DefaultIndexUpdater (*.gz -> *.zip) this.units = (int) contentLength / 1024; handle.switchToDeterminate(units); }
public StatusProgressPanel(final StatusProgressMonitor pm) { this.pm = pm; if(pm != null) { p = ProgressHandleFactory.createHandle(pm.getName()); p.start(100); p.switchToDeterminate(100); active = true; pm.addListener(this); } else { p = null; active = false; } }
handle.switchToDeterminate(toProcess.size());
handle.switchToDeterminate(4); int currentWorkDone = 0; handle.progress(++currentWorkDone);
@Override public void beginTask(String taskName, int totalWork) { if(totalWork < 0) { this.totalWorkUnits = 0; }else { this.totalWorkUnits = F * totalWork; } this.currentWorkUnits = 0; this.currentWorkUnitsRational = 0.0; if (progressHandle == null) { progressHandle = ProgressHandleFactory.createHandle(taskName, this); progressHandle.start(this.totalWorkUnits); } else { try { progressHandle.start(this.totalWorkUnits); } catch (java.lang.IllegalStateException e) { // if already started, use fall back progressHandle.switchToDeterminate(this.totalWorkUnits); } progressHandle.setDisplayName(taskName); } }
count++; support.getProgressHandle().switchToDeterminate(count);
@Messages({ "# {0} - repo name", "LBL_indexing_repo=Indexing Maven repository: {0}", "LBL_findIndexableDirs=Counting indexable directories..." }) @Override public void scanningStarted(IndexingContext ctx) { if (handle != null) { handle.finish(); } expectedDirs.clear(); encounteredDirs.clear(); handle = ProgressHandleFactory.createHandle(LBL_indexing_repo(ri != null ? ri.getName() : indexingContext.getId()), this); handle.start(); handle.progress(LBL_findIndexableDirs()); findIndexableDirs(ctx.getRepository()); handle.switchToDeterminate(expectedDirs.size()); } private void findIndexableDirs(File d) {
final Handle backup = bf.backup(toFormat); handle.switchToDeterminate(toFormat.size());
total += files.size(); progressHandle.switchToDeterminate(total); for (Map.Entry<Project, Set<File>> entry : filesMap.entrySet()) { RemoteSyncSupport.Worker worker = createWorker(entry.getKey(), execEnv);
try { handle.switchToIndeterminate(); handle.switchToDeterminate(5); int currentWorkDone = 0; FileObject projectDirectory = project.getProjectDirectory();
progressHandle.switchToDeterminate(CommonConstants.SERVER_PROGRESS_WORKUNITS); progressHandle.progress(serverProgress); activeServerProgressValue = serverProgress;