当前位置: 首页>>代码示例>>Java>>正文


Java ProgressUtils.showProgressDialogAndRun方法代码示例

本文整理汇总了Java中org.netbeans.api.progress.ProgressUtils.showProgressDialogAndRun方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressUtils.showProgressDialogAndRun方法的具体用法?Java ProgressUtils.showProgressDialogAndRun怎么用?Java ProgressUtils.showProgressDialogAndRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.progress.ProgressUtils的用法示例。


在下文中一共展示了ProgressUtils.showProgressDialogAndRun方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixButtonActionPerformed

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private void fixButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fixButtonActionPerformed
    final List<FixDescription> fixes = new LinkedList<FixDescription>();

    for (FixDescription fd : this.fixes) {
        if (fd.isSelected()) {
            fixes.add(fd);
        }
    }

    applyingFixes = true;

    try {
        ProgressUtils.showProgressDialogAndRun(new FixWorker(fixes), NbBundle.getMessage(AnalyzerTopComponent.class, "CAP_ApplyingFixes"), false);
    } finally {
        applyingFixes = false;
        stateChanged(null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AnalyzerTopComponent.java

示例2: instantiate

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:MasterDetailWizard.java

示例3: doTransfer

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
/**
 * Note: The streams will be closed after this method was invoked
 * 
 * @return true if transfer is complete and not interrupted 
 */
private boolean doTransfer(InputStream is, OutputStream os, Integer size, String title) throws IOException {
    MonitorableStreamTransfer ft = new MonitorableStreamTransfer(is, os, size);
    Throwable t;
    // Only show dialog, if the filesize is large enougth and has a use for the user
    if (size == null || size > (1024 * 1024)) {
        t = ProgressUtils.showProgressDialogAndRun(ft, title, false);
    } else {
        t = ft.run(null);
    }
    is.close();
    os.close();
    if (t != null && t instanceof RuntimeException) {
        throw (RuntimeException) t;
    } else if (t != null && t instanceof IOException) {
        throw (IOException) t;
    } else if (t != null) {
        throw new RuntimeException(t);
    }
    return !ft.isCancel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BlobFieldTableCellEditor.java

示例4: doTransfer

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
/**
 * Note: The character streams will be closed after this method was invoked
 * 
 * @return true if transfer is complete and not interrupted 
 */
private boolean doTransfer(Reader in, Writer out, Integer size, String title, boolean sizeEstimated) throws IOException {
    // Only pass size if it is _not_ estimated
    MonitorableCharacterStreamTransfer ft = new MonitorableCharacterStreamTransfer(in, out, sizeEstimated ? null : size);
    Throwable t;
    // Only show dialog, if the filesize is large enougth and has a use for the user
    if (size == null || size > (1024 * 1024)) {
        t = ProgressUtils.showProgressDialogAndRun(ft, title, false);
    } else {
        t = ft.run(null);
    }
    in.close();
    out.close();
    if (t != null && t instanceof RuntimeException) {
        throw (RuntimeException) t;
    } else if (t != null && t instanceof IOException) {
        throw (IOException) t;
    } else if (t != null) {
        throw new RuntimeException(t);
    }
    return !ft.isCancel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ClobFieldTableCellEditor.java

示例5: findRoot

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages({
    "TXT_JavadocSearch=Searching Javadoc in {0}"
})
private static Collection<? extends URL> findRoot(final File file, final int type) throws MalformedURLException {
    if (type != CLASSPATH) {                
        final FileObject fo = URLMapper.findFileObject(FileUtil.urlForArchiveOrDir(file));
        if (fo != null) {
            final Collection<FileObject> result = Collections.synchronizedCollection(new ArrayList<FileObject>());
            if (type == SOURCES) {
                final FileObject root = JavadocAndSourceRootDetection.findSourceRoot(fo);
                if (root != null) {
                    result.add(root);
                }
            } else if (type == JAVADOC) {
                final AtomicBoolean cancel = new AtomicBoolean();
                class Task implements ProgressRunnable<Void>, Cancellable {
                    @Override
                    public Void run(ProgressHandle handle) {
                        result.addAll(JavadocAndSourceRootDetection.findJavadocRoots(fo, cancel));
                        return null;
                    }

                    @Override
                    public boolean cancel() {
                        cancel.set(true);
                        return true;
                    }
                }
                final ProgressRunnable<Void> task = new Task();
                ProgressUtils.showProgressDialogAndRun(task, Bundle.TXT_JavadocSearch(file.getAbsolutePath()), false);
            }
            if (!result.isEmpty()) {
                return result.stream()
                        .map(FileObject::toURL)
                        .collect(Collectors.toList());
            }                    
        }
    }
    return Collections.singleton(Utilities.toURI(file).toURL());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:J2SEPlatformCustomizer.java

示例6: testShowProgressDialogAndRun_3args_2

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
public void testShowProgressDialogAndRun_3args_2() throws InterruptedException {
    final WM wm = Lookup.getDefault().lookup(WM.class);
    //make sure main window is on screen before proceeding
    wm.await();
    final JFrame jf = (JFrame) WindowManager.getDefault().getMainWindow();
    final CountDownLatch countDown = new CountDownLatch(1);
    final AtomicBoolean glassPaneFound = new AtomicBoolean(false);
    final boolean testGlassPane = canTestGlassPane();
    class R implements Runnable {
        volatile boolean hasRun;
        @Override
        public void run() {
            try {
                wm.waitForGlassPane();
                if (testGlassPane) {
                    glassPaneFound.set(jf.getGlassPane() instanceof RunOffEDTImpl.TranslucentMask);
                }
                hasRun = true;
            } finally {
                countDown.countDown();
            }
        }
    }
    R r = new R();
    ProgressUtils.showProgressDialogAndRun(r, "Something");
    countDown.await();
    assertTrue (r.hasRun);
    assertTrue ("Glass pane not set", !testGlassPane || glassPaneFound.get());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:RunOffEDTImplTest.java

示例7: save

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages({
    "# {0} - file name", "MSG_SavingFile=Saving {0}"
})
private String save(int index, boolean removeSavedFromList) {
    final SaveCookie saveCookie = listModel.getElementAt(index);

    final AtomicReference<String> errMsg = new AtomicReference<String>();
    ProgressUtils.showProgressDialogAndRun(new Runnable() {
        @Override
        public void run () {
            try {
                saveCookie.save();
            } catch (IOException ex) {
                String msg = Exceptions.findLocalizedMessage(ex);
                errMsg.set(msg);
                if (msg == null) {
                    msg = getMessage("MSG_exception_while_saving",       //NOI18N
                                        saveCookie.toString());
                    ex = Exceptions.attachLocalizedMessage(ex, msg);
                }
                Exceptions.printStackTrace(ex);
            }
        }
    }, Bundle.MSG_SavingFile(saveCookie.toString()));
    // only remove the object if the save succeeded
    if (errMsg.get() == null && removeSavedFromList) {
        listModel.removeItem(index);
    }
    return errMsg.get();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:FilesModifiedConfirmation.java

示例8: buttonCreateActionPerformed

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private void buttonCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCreateActionPerformed
    final File ejreTmp = createJRETempDir();
    final Pair<List<String>,String> data = CreateJREPanel.configure(
        username.getText(),
        host.getText(),
        ejreTmp);
    if (data != null) {
        final ConnectionMethod cm;
        if (radioButtonPassword.isSelected()) {
            cm = ConnectionMethod.sshPassword(
                    host.getText(),
                    ((Integer) port.getValue()).intValue(),
                    username.getText(),
                    String.valueOf(password.getPassword()));
        } else {
            cm = ConnectionMethod.sshKey(
                    host.getText(),
                    ((Integer) port.getValue()).intValue(),
                    username.getText(),
                    new File(keyFilePath.getText()),
                    String.valueOf(passphrase.getPassword()));
        }
        ProgressUtils.showProgressDialogAndRun(
                new ProgressRunnable<Void>() {
            @Override
            public Void run(ProgressHandle handle) {
                handle.switchToDeterminate(2);
                handle.progress(NbBundle.getMessage(SetUpRemotePlatform.class, "LBL_JRECreate"),0);
                try {
                    int res = jreCreate(data.first());
                    if (res != 0) {
                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                DialogDisplayer.getDefault().notify(
                                        new NotifyDescriptor.Message(
                                        NbBundle.getMessage(SetUpRemotePlatform.class, "ERROR_JRECreate"),
                                        NotifyDescriptor.ERROR_MESSAGE));
                            }
                        });
                        return null;
                    };
                    handle.progress(NbBundle.getMessage(SetUpRemotePlatform.class, "LBL_JREUpload"), 1);
                    res = upload(ejreTmp, data.second(), cm, wizardDescriptor);
                    if (res != 0) {
                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                DialogDisplayer.getDefault().notify(
                                        new NotifyDescriptor.Message(
                                        NbBundle.getMessage(SetUpRemotePlatform.class, "ERROR_JREUpload"),
                                        NotifyDescriptor.ERROR_MESSAGE));
                            }
                        });
                        return null;
                    }
                    handle.finish();
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            jreLocation.setText(data.second());
                        }
                    });
                    return null;
                } finally {
                    deleteAll(ejreTmp);
                }
            }
        },
                NbBundle.getMessage(SetUpRemotePlatform.class, "LBL_CreatingNewPlatform"),
                true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:74,代码来源:SetUpRemotePlatform.java

示例9: setValues

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages("readingAdvancedOptions=Retrieving options...")
private void setValues( final Lookup context ) {
    ProgressUtils.showProgressDialogAndRun(new InitWorker(context),
            Bundle.readingGwtOptions());
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:6,代码来源:AdvancedGwtOptionsPanel.java

示例10: setValues

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages("readingGwtOptions=Retrieving options...")
private void setValues( final Lookup context ) {
    ProgressUtils.showProgressDialogAndRun(new InitWorker(context),
            Bundle.readingGwtOptions());
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:6,代码来源:GwtCompilerOptionsPanel.java

示例11: setValues

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages("readingJettyOptions=Retrieving options...")
private void setValues() {
    ProgressUtils.showProgressDialogAndRun(new InitRunnable(),
            Bundle.readingJettyOptions());
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:6,代码来源:JettyOptionsPanel.java

示例12: setValues

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@NbBundle.Messages("readingDebugOptions=Retrieving options...")
private void setValues( final Lookup context ) {
    ProgressUtils.showProgressDialogAndRun(new InitRunnable(context),
            Bundle.readingDebugOptions());
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:6,代码来源:DevModeOptionsPanel.java


注:本文中的org.netbeans.api.progress.ProgressUtils.showProgressDialogAndRun方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。