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


Java ProgressHandle.switchToDeterminate方法代码示例

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


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

示例1: finnishProgress

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
protected void finnishProgress() {
    // TODO add failed and restart texts                
    if (isCanceled()) {
        getLogger().logCommandLine("==[IDE]== " + DateFormat.getDateTimeInstance().format(new Date()) + " " + runningName + " " + NbBundle.getMessage(ContextAction.class, "MSG_Progress_Canceled")); // NOI18N
    } else {
        final ProgressHandle progress = getProgressHandle();
        progress.switchToDeterminate(100);
        progress.progress(NbBundle.getMessage(ContextAction.class, "MSG_Progress_Done"), 100); // NOI18N
        if (System.currentTimeMillis() > progressStamp) {
            Subversion.getInstance().getParallelRequestProcessor().post(new Runnable() {
                @Override
                public void run() {
                    progress.finish();
                }
            }, 15 * 1000);
        } else {
            progress.finish();
        }
        getLogger().logCommandLine("==[IDE]== " + DateFormat.getDateTimeInstance().format(new Date()) + " " + runningName + " " + NbBundle.getMessage(ContextAction.class, "MSG_Progress_Finished")); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ContextAction.java

示例2: run

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Void run(ProgressHandle handle) {
    handle.switchToDeterminate(fixes.size());

    int clock = 0;

    for (FixDescription f : fixes) {
        if (cancel.get()) break;
        
        try {
            f.implement();
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        } finally {
            handle.progress(++clock);
        }
    }

    handle.finish();

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:AnalyzerTopComponent.java

示例3: run

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public String run(ProgressHandle handle) {
    handle.switchToDeterminate(5);
    for (int i= 0; i < 5; i++) {
        handle.progress("Job " + i, i);
    }
    return "Done";
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:RunOffEDTImplTest.java

示例4: build

import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@org.netbeans.api.annotations.common.SuppressWarnings("OS_OPEN_STREAM")
@Messages({
    "# {0} - ZIP file", "MSG_building=Building {0}",
    "# {0} - ZIP entry name", "MSG_packed=Packed: {0}"
})
private static boolean build(File root, File zip) throws IOException {
    final AtomicBoolean canceled = new AtomicBoolean();
    ProgressHandle handle = ProgressHandleFactory.createHandle(MSG_building(zip.getName()), new Cancellable() {
        @Override public boolean cancel() {
            return canceled.compareAndSet(false, true);
        }
    });
    handle.start();
    try {
        List<String> files = new ArrayList<String>();
        scanForFiles(root, files, "", handle, canceled, true);
        if (canceled.get()) {
            return false;
        }
        handle.switchToDeterminate(files.size());
        OutputStream os = new FileOutputStream(zip);
        try {
            ZipOutputStream zos = new ZipOutputStream(os);
            Set<String> written = new HashSet<String>();
            String prefix = root.getName() + '/';
            for (int i = 0; i < files.size(); i++) {
                if (canceled.get()) {
                    return false;
                }
                String name = files.get(i);
                writeEntry(prefix + name, written, zos, new File(root, name));
                handle.progress(MSG_packed(name), i);
            }
            zos.finish();
            zos.close();
        } finally {
            os.close();
        }
    } finally {
        handle.finish();
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:ExportZIP.java


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