Refine search
if (target != null) { final int caretPosition = target.getCaretPosition(); final AtomicBoolean cancel = new AtomicBoolean(); final AtomicReference<ImportData> importData = new AtomicReference<>(); final UserTask task = new UserTask() { ProgressUtils.runOffEventDispatchThread(new Runnable() { if (importData.get() != null && !cancel.get()) { SwingUtilities.invokeLater(new Runnable() {
/** * Returns set of instantiated objects. * * @return set of instantiated objects. * @throws IOException when the objects cannot be instantiated. */ @Override public Set instantiate() throws IOException { final IOException[] ex = new IOException[1]; String msgKey = (delegateIterator==null) ? "MSG_DBAppCreate" : "MSG_MasterDetailCreate"; // NOI18N String msg = NbBundle.getMessage(MasterDetailWizard.class, msgKey); Set set = ProgressUtils.showProgressDialogAndRun(new ProgressRunnable<Set>() { @Override public Set run(ProgressHandle handle) { Set innerSet = null; try { innerSet = instantiate0(); } catch (IOException ioex) { ex[0] = ioex; } return innerSet; } }, msg, false); if (ex[0] != null) { throw ex[0]; } return set; }
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed AtomicBoolean cancelled = new AtomicBoolean(); final List<Gem> gems = new ArrayList<Gem>(); Runnable fetchGemsTask = new Runnable() { ProgressUtils.runOffEventDispatchThread(fetchGemsTask, NbBundle.getMessage(GemRequirementsPanel.class, "GemRequirementsPanel.fetchGems"), cancelled, true); if (cancelled.get()) { return; DialogDescriptor dd = new DialogDescriptor(gemListPanel, NbBundle.getMessage(GemRequirementsPanel.class, "GemRequirementsPanel.chooseGems")); dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION); dd.setModal(true);
public void performClickAction(final Document doc, final int offset) { final AtomicBoolean cancel = new AtomicBoolean(); ProgressUtils.runOffEventDispatchThread(new Runnable() { public void run() { performGoTo(doc, offset, file, method, targetType, cancel); } }, NbBundle.getMessage(TestNGSuiteHyperlingProvider.class, "LBL_GoToDeclaration"), cancel, false); }
public void selectNext() { if (selectionInfos == null) { cancel = new AtomicBoolean(); ProgressUtils.runOffEventDispatchThread(new Runnable() { @Override public void run() { CsmCodeBlockProvider.Scope scope = CsmCodeBlockProvider.getDefault().getScope(target.getDocument(), target.getCaretPosition()); selectionInfos = initSelectionPath(target, scope); } }, name, cancel, false); } run(); }
@Override public void run() { CndUtils.assertNonUiThread(); closed.set(true); final Runnable runnable = new RunnableImpl(); if (CndUtils.isStandalone() || CndUtils.isUnitTestMode() || !ModelSupport.instance().hasOpenedProjects()) { runnable.run(); } else { ProgressUtils.showProgressDialogAndRun(runnable, NbBundle.getMessage(Installer.class, "CLOSE_PROJECT_DIALOG_MESSAGE")); //NOI18N } }
} catch (TimeoutException ex) { ProgressUtils.showProgressDialogAndRun(new Runnable() { @Override public void run() {
@Override public void run() { ProgressUtils.runOffEventDispatchThread(classFinder, Bundle.JavaUtils_title_class_searching(), cancel, false); } }, Bundle.JavaUtils_title_class_searching());
@Override protected void onApply() { BenchmarkExecutor executor = new BenchmarkExecutor(); //launch processing with a progress bar ProgressHandleMonitor pm = ProgressHandleMonitor.create("Running benchmark", executor); executor.setProgressHandleMonitor(pm); ProgressUtils.runOffEventThreadWithProgressDialog(executor, "Benchmarking....", pm.getProgressHandle(), true, 50, 1000); }
private static void run( final Window parent, final String title, final String message, final LongWorker worker, final Cancellable canceler) { Worker r = (canceler != null) ? new CancellableWorker(worker, canceler) : new Worker(worker); ProgressUtils.runOffEventThreadWithCustomDialogContent(r, title, new ModalMessageDlgPane(message == null ? title : message), 1000, 2000); }
private Collection<FileObject> setupWebFiles(FileObject webFolder) { final Collection<FileObject> myWebFiles = new LinkedList<FileObject>(); if (webFolder == null) { ifNecessaryShowNoWebFolderDialog(); } else { // loading all the relevant files may take quite a while - see #177459 // they're also loaded again every time the page flow editor is opened; // would be better to hold onto them and listen for changes in the web dir(s). // for now fixing it this way as it is safer (i'm not familiar // with the page flow editor, and this is probably not the best place for this code. // but in any case this should be a pretty safe fix). AtomicBoolean canceled = new AtomicBoolean(); ProgressUtils.runOffEventDispatchThread(new Runnable() { @Override public void run() { myWebFiles.addAll(getAllProjectRelevantFilesObjects()); } }, NbBundle.getMessage(PageFlowController.class, "MSG_LoadingWebFiles"), canceled, false); } return myWebFiles; }
final List<String> missingNames) { final AtomicBoolean cancel = new AtomicBoolean(); final List<String> singleCandidates = new ArrayList<>(); final Map<String, Set<ImportCandidate>> multipleCandidates = new HashMap<>(); ProgressUtils.runOffEventDispatchThread(new Runnable() {
@NbBundle.Messages("ProjectPropertiesSupport.project.metadata.saving=Saving project metadata...") private static void saveTestSources(final PhpProject project, final String propertyName, final File testDir) { ProgressUtils.showProgressDialogAndRun(new Runnable() { @Override public void run() { // XXX reference helper // relativize text path File projectDirectory = FileUtil.toFile(project.getProjectDirectory()); String testPath = PropertyUtils.relativizeFile(projectDirectory, testDir); if (testPath == null) { // path cannot be relativized => use absolute path (any VCS can be hardly use, of course) testPath = testDir.getAbsolutePath(); } PhpProjectProperties.save(project, Collections.singletonMap(propertyName, testPath), Collections.<String, String>emptyMap()); } }, Bundle.ProjectPropertiesSupport_project_metadata_saving()); }
private Boolean exportProduct(Product exportProduct, File newFile, String formatName) { SnapApp.getDefault().setStatusBarMessage(MessageFormat.format("Exporting product ''{0}'' to {1}...", exportProduct.getDisplayName(), newFile)); WriteProductOperation operation = new WriteProductOperation(exportProduct, newFile, formatName, false); ProgressUtils.runOffEventThreadWithProgressDialog(operation, getDisplayName(), operation.getProgressHandle(), true, 50, 1000); SnapApp.getDefault().setStatusBarMessage(""); return operation.getStatus(); }
private static void run( final Window parent, final String title, final String message, final LongWorker worker, final Cancellable canceler) { Worker r = (canceler != null) ? new CancellableWorker(worker, canceler) : new Worker(worker); ProgressUtils.runOffEventThreadWithCustomDialogContent(r, title, new ModalMessageDlgPane(message == null ? title : message), 1000, 2000); }
@NbBundle.Messages("FtpConfigurationValidator.proxy.detecting=Detecting HTTP proxy...") private static synchronized boolean hasProxy(final String host) { assert Thread.holdsLock(FtpConfigurationValidator.class); if (lastProxy != null && lastProxy.first().equals(host)) { return lastProxy.second(); } final AtomicBoolean hasProxy = new AtomicBoolean(); ProgressUtils.runOffEventDispatchThread(new Runnable() { @Override public void run() { hasProxy.set(RemoteUtils.hasHttpProxy(host)); } }, Bundle.FtpConfigurationValidator_proxy_detecting(), new AtomicBoolean(), false); lastProxy = Pair.of(host, hasProxy.get()); return lastProxy.second(); }
ProgressUtils.runOffEventDispatchThread(new Runnable() { @Override public void run() { LOG.log(Level.FINEST, "PageFlowEditor componentClosed save took: {0} ms", (System.currentTimeMillis() - time)); }, Bundle.PageFlowElement_lbl_saving_file(), new AtomicBoolean(false), true, 500, 2000); } else { DialogDescriptor dialog; if (storageFile != null) { dialog = new DialogDescriptor( NbBundle.getMessage(PageFlowElement.class, "MSG_NoFileToSave", storageFile), //NOI18N NbBundle.getMessage(PageFlowElement.class, "TLE_NoFileToSave")); //NOI18N } else { dialog = new DialogDescriptor( NbBundle.getMessage(PageFlowElement.class, "MSG_NoProjectToSave"), //NOI18N NbBundle.getMessage(PageFlowElement.class, "TLE_NoFileToSave")); //NOI18N
/** * Obtains JsfLibrariesSupport for given textComponent. Can returns null if the action was too length and the * user canceled it. Check the return type for null and stop the action if null returned. * @param targetComponent target * @return {@code null} if the action was canceled, {@code JsfLibrariesSupport} otherwise */ @Messages("PaletteUtils.lbl.preparing.palette.component=Preparing palette component...") protected static JsfLibrariesSupport getJsfLibrariesSupport(JTextComponent targetComponent) { AtomicBoolean cancel = new AtomicBoolean(); JsfLibrariesGetter jsfLibrariesGetter = new JsfLibrariesGetter(targetComponent, cancel); ProgressUtils.runOffEventDispatchThread(jsfLibrariesGetter, Bundle.PaletteUtils_lbl_preparing_palette_component(), cancel, false, 100, 3000); return jsfLibrariesGetter.getJsfLibrariesSupport(); }
DialogDescriptor desc = new DialogDescriptor ( panel, NbBundle.getMessage (JSEDeploymentPanel.class, "LBL_ChooseMainClassForSwitch_Title" ), // NOI18N true, options, NbBundle.getMessage (JSEDeploymentPanel.class, "JSEDeploymentPanel.confirmSwitchToFX.text" ), // NOI18N NbBundle.getMessage (JSEDeploymentPanel.class, "JSEDeploymentPanel.confirmSwitchToFX.title" ), // NOI18N NotifyDescriptor.OK_CANCEL_OPTION); if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) { if(canceller != null) { canceller.cancelCustomizer(); ProgressUtils.showProgressDialogAndRun(new Runnable() { @Override public void run() {
/** * Show a modal progress dialog that blocks the main window, 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 */ public static void showProgressDialogAndRun(Runnable operation, String displayName) { showProgressDialogAndRun(new RunnableWrapper(operation), displayName, false); }