int dialogAfter) BaseProgressUtils.runOffEventThreadWithProgressDialog(operation, dialogTitle, progress, includeDetailLabel, waitCursorAfter, dialogAfter);
/** * Show a modal progress dialog that blocks the main window and all other * currently displayed frames or dialogs, while running the passed runnable * on a background thread with an indeterminate-state progress bar. * <p/> * This method is thread-safe, and will block until the operation has * completed, regardless of what thread calls this method. * <p/> * The resulting progress UI should show a cancel button if the passed * runnable implements org.openide.util.Cancellable. * . * @param operation A runnable to run * @param displayName The display name of the operation, to show in the dialog * @since 1.19 * @deprecated use {@link BaseProgressUtils} */ public static void showProgressDialogAndRun(Runnable operation, String displayName) { BaseProgressUtils.showProgressDialogAndRun(operation, displayName); }
/** * Runs operation out of event dispatch thread, blocks UI while operation is in progress. First it shows * wait cursor after ~50ms elapses, if operation takes longer than ~10s a dialog with Cancel button is shown. * <p> * This method is supposed to be used by user invoked foreground actions, that are expected to run very fast in vast majority of cases. * However, in some rather rare cases (e.g. extensive IO operations in progress), supplied operation may need longer time. In such case * this method first displays wait cursor and if operation takes even more time it displays dialog allowing to cancel operation. * DO NOT use this method for operations that may take long time under normal circumstances! * @param operation operation to perform * @param operationDescr text shown in dialog * @param cancelOperation set to true if user canceled the operation * @param waitForCanceled true if method should wait until canceled task is finished (if it is not finished in 1s ISE is thrown) * @deprecated Use {@link BaseProgressUtils} */ public static void runOffEventDispatchThread(Runnable operation, String operationDescr, AtomicBoolean cancelOperation, boolean waitForCanceled) { BaseProgressUtils.runOffEventDispatchThread(operation, operationDescr, cancelOperation, waitForCanceled, DISPLAY_WAIT_CURSOR_MS, DISPLAY_DIALOG_MS); }
/** * Show a modal progress dialog that blocks the main window and all other * currently displayed frames or dialogs while running a background process. * This call should block until the work is started, and then return a task * which can be monitored for completion or cancellation. This method will * not block while the work is run, only until the progress UI is * initialized. * <p/> * The resulting progress UI should show a cancel button if the passed * runnable implements org.openide.util.Cancellable. * * @param operation * @param handle * @param includeDetailLabel * @return * @deprecated use {@link BaseProgressUtils} */ public static <T> Future<T> showProgressDialogAndRunLater (final ProgressRunnable<T> operation, final ProgressHandle handle, boolean includeDetailLabel) { return BaseProgressUtils.showProgressDialogAndRunLater(operation, handle, includeDetailLabel); }
/** * Show a modal progress dialog that blocks the main window and all other * currently displayed frames or dialogs, while running the passed runnable * on a background thread. * <p/> * This method is thread-safe, and will block until the operation has * completed, regardless of what thread calls this method. * <p/> * The resulting progress UI should show a cancel button if the passed * runnable implements org.openide.util.Cancellable. * <p/> * Unless you are being passed the runnable or progress handle from foreign * code (such as in WizardDescriptor.progressInstantiatingIterator), it * is usually simpler to use {@link #showProgressDialogAndRun(ProgressRunnable, String, boolean)}. * * @param operation A runnable to run in the background * @param progress A progress handle to create a progress bar for * @param includeDetailLabel True if the caller will use * ProgressHandle.progress (String, int), false if not. If true, the * created dialog will include a label that shows progress details. * @since 1.19 * @deprecated Use {@link BaseProgressUtils} */ public static void showProgressDialogAndRun(Runnable operation, ProgressHandle progress, boolean includeDetailLabel) { BaseProgressUtils.showProgressDialogAndRun(operation, progress, includeDetailLabel); }
static Boolean saveProduct(Product product) { Assert.notNull(product.getFileLocation()); final File file = product.getFileLocation(); if (file.isFile() && !file.canWrite()) { Dialogs.showWarning(Bundle.CTL_SaveProductActionName(), MessageFormat.format("The product\n" + "''{0}''\n" + "exists and cannot be overwritten, because it is read only.\n" + "Please choose another file or remove the write protection.", file.getPath()), null); return false; } SnapApp.getDefault().setStatusBarMessage(MessageFormat.format("Writing product ''{0}'' to {1}...", product.getDisplayName(), file)); boolean incremental = true; WriteProductOperation operation = new WriteProductOperation(product, incremental); BaseProgressUtils.runOffEventThreadWithProgressDialog(operation, Bundle.CTL_SaveProductActionName(), operation.getProgressHandle(), true, 50, 1000); SnapApp.getDefault().setStatusBarMessage(""); return operation.getStatus(); }
/** * Runs operation out of event dispatch thread, blocks UI while operation is in progress. First it shows * wait cursor after <i>waitCursorAfter</i> elapses, if operation takes longer than <i>dialogAfter</i> a dialog with Cancel button is shown. * <p> * This method is supposed to be used by user invoked foreground actions, that are expected to run very fast in vast majority of cases. * However, in some rather rare cases (e.g. extensive IO operations in progress), supplied operation may need longer time. In such case * this method first displays wait cursor and if operation takes even more time it displays dialog allowing to cancel operation. * DO NOT use this method for operations that may take long time under normal circumstances! * @param operation operation to perform * @param operationDescr text shown in dialog * @param cancelOperation set to true if user canceled the operation * @param waitForCanceled true if method should wait until canceled task is finished (if it is not finished in 1s ISE is thrown) * @param waitCursorAfter time in ms after which wait cursor is shown * @param dialogAfter time in ms after which dialog with "Cancel" button is shown * @since 1.19 * @deprecated Use {@link BaseProgressUtils} */ public static void runOffEventDispatchThread(Runnable operation, String operationDescr, AtomicBoolean cancelOperation, boolean waitForCanceled, int waitCursorAfter, int dialogAfter) { BaseProgressUtils.runOffEventDispatchThread(operation, operationDescr, cancelOperation, waitForCanceled, waitCursorAfter, dialogAfter); }
/** * Show a modal progress dialog that blocks the main window and all other * currently displayed frames or dialogs, while running the passed runnable * on a background thread. * <p/> * This method is thread-safe, and will block until the operation has * completed, regardless of what thread calls this method. * <p/> * The resulting progress UI should show a cancel button if the passed * runnable implements org.openide.util.Cancellable. * * @param <T> The result type - use Void if no return type needed * @param operation A runnable-like object which performs work in the * background, and is passed a ProgressHandle to update progress * @param displayName The display name for this operation * @param includeDetailLabel If true, include a lable to show progress * details (needed only if you plan to call ProgressHandle.setProgress(String, int) * @return The result of the operation. * @since 1.19 * @deprecated use {@link BaseProgressUtils} */ public static <T> T showProgressDialogAndRun(final ProgressRunnable<T> operation, final String displayName, boolean includeDetailLabel) { return BaseProgressUtils.showProgressDialogAndRun(operation, displayName, includeDetailLabel); }
BaseProgressUtils.runOffEventThreadWithProgressDialog(operation, getDisplayName(), operation.getProgressHandle(),
p.runOffEventThreadWithCustomDialogContent(operation, dialogTitle, content, waitCursorAfter, dialogAfter); } else { BaseProgressUtils.runOffEventDispatchThread(operation, dialogTitle, new AtomicBoolean(false),
}) public void show() { DockerImageDetail info = BaseProgressUtils.showProgressDialogAndRun( new DockerImageInfoRunnable(tag.getImage()), Bundle.MSG_ReceivingImageInfo(), false);