/** * Create a handle for a long lasting task that is not triggered by explicit user action. * Such tasks have lower priority in the UI. * @param displayName to be shown in the progress UI * @return an instance of {@link org.netbeans.api.progress.ProgressHandle}, initialized but not started. */ public static ProgressHandle createSystemHandle(String displayName) { return createSystemHandle(displayName, null); }
/** * Create a cancelable handle for a task that is not triggered by explicit user action. * Such tasks have lower priority in the UI. * @param displayName to be shown in the progress UI * @param allowToCancel either null, if the task cannot be cancelled or * an instance of {@link org.openide.util.Cancellable} that will be called when user * triggers cancel of the task. * @return an instance of {@link org.netbeans.api.progress.ProgressHandle}, initialized but not started. */ public static ProgressHandle createSystemHandle(String displayName, Cancellable allowToCancel) { return createSystemHandle(displayName, allowToCancel, null); }
/** * Create a handle for a long lasting task that is not triggered by explicit user action. * Such tasks have lower priority in the UI. * @param displayName to be shown in the progress UI * @return an instance of {@link org.netbeans.api.progress.ProgressHandle}, initialized but not started. */ public static ProgressHandle createSystemHandle(String displayName) { return createSystemHandle(displayName, null, null); }
public ExportSensorRunFileWriter(File csvFile, Field[] fields) throws IOException { this.csvFile = csvFile; this.fields = fields.clone(); // Clone! fstream = new FileWriter(csvFile); out = new BufferedWriter(fstream); getExportButton().setEnabled(false); progressHandle = ProgressHandleFactory.createSystemHandle(processTitle); }
/** * Create an aggregating progress ui handle for a long lasting task. * @param contributors the initial set of progress indication contributors that are aggregated in the UI. * @param allowToCancel either null, if the task cannot be cancelled or * an instance of {@link org.openide.util.Cancellable} that will be called when user * triggers cancel of the task. * @param linkOutput an <code>Action</code> instance that links the running task in the progress bar * to an output of the task. The action is assumed to open the apropriate component with the task's output. * @param displayName to be shown in the progress UI * @return an instance of <code>ProgressHandle</code>, initialized but not started. * */ public static AggregateProgressHandle createSystemHandle(String displayName, ProgressContributor[] contributors, Cancellable allowToCancel, Action linkOutput) { return doCreateHandle(displayName, contributors, allowToCancel, true, ProgressHandleFactory.createSystemHandle(displayName, allowToCancel, linkOutput)); }
final ProgressHandle progressHandle = ProgressHandleFactory.createSystemHandle( Bundle.MappingSelectionPanel_processButton_progressText(src.getName())); progressHandle.start();
org.esa.snap.core.gpf.descriptor.dependency.Bundle modifiedBundle = newOperatorDescriptor.getBundle(); try (BundleInstaller installer = new BundleInstaller(newOperatorDescriptor)) { ProgressHandle progressHandle = ProgressHandleFactory.createSystemHandle("Installing bundle"); installer.setProgressMonitor(new ProgressHandler(progressHandle, false)); installer.setCallback(() -> {
@Override public void run() { ProgressHandle handle = ProgressHandleFactory.createSystemHandle(Bundle.LBL_LoadingTasks()); handle.start(); try { String data = null; String work = gruntFile.getParent().getPath(); if (Utilities.isWindows()) { data = ProcessUtilities.callProcess("cmd", work, true, 3 * 60 * 1000 , "/C grunt -h --no-color");//NOI18N } else if (Utilities.isMac()) { data = ProcessUtilities.callProcess("/bin/bash", work, true, 3 * 60 * 1000 , "-lc", "grunt -h --no-color");//NOI18N } else { data = ProcessUtilities.callProcess("grunt", work, true, 3 * 60 * 1000 , "-h", "--no-color");//NOI18N } parse(data, gruntFile); } catch (IOException ex) { Collection<Target> col = new ArrayList<>(); col.add(new Target("default", gruntFile)); //NOI18n cache.put(gruntFile.getPath(), Pair.of(gruntFile.lastModified().getTime(), col)); } finally { handle.finish(); m.rebuild(); } }
private void initSamples() throws IOException { SamplesInputStream stream = new SamplesInputStream(npssFile.getInputStream()); int samplesGuess = (int)(npssFile.getSize()/130); ProgressHandle ph = ProgressHandleFactory.createSystemHandle("Computing snapshot samples"); ph.start(samplesGuess); for(ThreadsSample s = stream.readSample(); s != null; s = stream.readSample()) { samples++; lastTimestamp = s.getTime(); if (samples < samplesGuess) { ph.progress(samples); } } ph.finish(); } }