本文整理汇总了Java中org.netbeans.api.progress.ProgressHandle.finish方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressHandle.finish方法的具体用法?Java ProgressHandle.finish怎么用?Java ProgressHandle.finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.progress.ProgressHandle
的用法示例。
在下文中一共展示了ProgressHandle.finish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doActivate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void doActivate() {
if (!helper.canBundleDerby()) {
LOGGER.fine("Default platform cannot bundle Derby"); // NOI18N
return;
}
ProgressHandle handle = ProgressHandleFactory.createSystemHandle(NbBundle.getMessage(DerbyActivator.class, "MSG_RegisterJavaDB"));
handle.start();
try {
if (registerDerby()) {
registerSampleDatabase();
}
} finally {
handle.finish();
}
}
示例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;
}
示例3: createHeap
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static Heap createHeap(File heapFile) throws FileNotFoundException, IOException {
ProgressHandle pHandle = null;
try {
pHandle = ProgressHandle.createHandle(Bundle.ClassesListController_LoadingDumpMsg());
pHandle.setInitialDelay(0);
pHandle.start(HeapProgress.PROGRESS_MAX*2);
setProgress(pHandle,0);
Heap heap = HeapFactory.createHeap(heapFile);
setProgress(pHandle,HeapProgress.PROGRESS_MAX);
heap.getSummary(); // Precompute HeapSummary within progress
return heap;
} finally {
if (pHandle != null) {
pHandle.finish();
}
}
}
示例4: performAction
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
protected final void performAction(Node[] activatedNodes) {
for (final Node node : activatedNodes) {
final StatefulDockerContainer container = node.getLookup().lookup(StatefulDockerContainer.class);
if (container != null) {
final ProgressHandle handle = ProgressHandle.createHandle(getProgressMessage(container.getContainer()));
handle.start();
Runnable task = new Runnable() {
@Override
public void run() {
try {
performAction(container.getContainer());
} catch (Exception ex) {
handleException(ex);
} finally {
handle.finish();
}
}
};
requestProcessor.post(task);
}
}
}
示例5: instantiate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
@Messages({"PRG_Dir=Creating directory", "PRG_FINISH=Finishing..."})
public Set<FileObject> instantiate (ProgressHandle handle) throws IOException {
handle.start();
try {
handle.progress(Bundle.PRG_Dir());
ProjectInfo vi = new ProjectInfo((String) wiz.getProperty("groupId"), (String) wiz.getProperty("artifactId"), (String) wiz.getProperty("version"), (String) wiz.getProperty("package")); //NOI18N
String[] splitlog = StringUtils.split(log, ":");
ArchetypeWizardUtils.logUsage(splitlog[0], splitlog[1], splitlog[2]);
File projFile = FileUtil.normalizeFile((File) wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
CreateProjectBuilder builder = createBuilder(projFile, vi, handle);
builder.create();
handle.progress(Bundle.PRG_FINISH());
return ArchetypeWizardUtils.openProjects(projFile, null);
} finally {
handle.finish();
}
}
示例6: refreshModuleList
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static void refreshModuleList() {
if (catalogRefreshed.compareAndSet(false, true)) {
final ProgressHandle refreshHandle = ProgressHandle.createHandle(NbBundle.getMessage(
MissingModuleProblemsProvider.class,
"TXT_ModuleListRefresh"));
refreshHandle.start();
try {
for (UpdateUnitProvider provider : UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(false)) {
try {
provider.refresh(refreshHandle, true);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
} finally {
refreshHandle.finish();
}
}
}
示例7: uploadLogs
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
private static URL uploadLogs(URL postURL, String id, Map<String,String> attrs,
List<LogRecord> recs, DataType dataType, boolean isErrorReport,
SlownessData slownData, boolean isOOM, boolean isAfterRestart) throws IOException {
ProgressHandle h = null;
//Do not show progress UI for metrics upload
if (dataType != DataType.DATA_METRICS) {
h = ProgressHandleFactory.createHandle(NbBundle.getMessage(Installer.class, "MSG_UploadProgressHandle"));
}
try {
return uLogs(h, postURL, id, attrs, recs, dataType, isErrorReport, slownData, isOOM, isAfterRestart);
} finally {
if (h != null) {
h.finish();
}
}
}
示例8: 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
}
}
示例9: findNonExcludedPackages
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/** Fills given collection with flattened packages under given folder
*@param target The collection to be filled
*@param fo The folder to be scanned
* @param group the group to scan
* @param createPackageItems if false the collection will be filled with file objects; if
* true PackageItems will be created.
* @param showProgress whether to show a progress handle or not
*/
@Messages({"# {0} - root folder", "PackageView.find_packages_progress=Finding packages in {0}"})
static void findNonExcludedPackages(PackageViewChildren children, Collection<PackageItem> target, FileObject fo, SourceGroup group, boolean showProgress) {
if (showProgress) {
ProgressHandle progress = ProgressHandleFactory.createHandle(PackageView_find_packages_progress(FileUtil.getFileDisplayName(fo)));
progress.start(1000);
findNonExcludedPackages(children, target, fo, group, progress, 0, 1000);
progress.finish();
} else {
findNonExcludedPackages(children, target, fo, group, null, 0, 0);
}
}
示例10: instantiate
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
try {
handle.start();
return instantiateWProgress(handle);
} finally {
handle.finish();
}
}
示例11: stopHandle
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public static void stopHandle(ExecutionEnvironment env) {
ProgressHandle ph;
synchronized (lock) {
ph = envToHandle.remove(env);
}
if (ph != null) {
ph.finish();
}
}
示例12: openStream
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
* Like {@link URL#openStream} but uses the platform's user JAR cache ({@code ArchiveURLMapper}) when available.
* @param url a url to open
* @return its input stream
* @throws IOException for the usual reasons
*/
@NonNull
private static InputStream openStream(@NonNull final URL url, @NullAllowed final String message) throws IOException {
ProgressHandle progress = null;
if (message != null) {
progress = ProgressHandle.createHandle(message);
progress.start();
}
try {
if (url.getProtocol().equals("jar")) { // NOI18N
FileObject f = URLMapper.findFileObject(url);
if (f != null) {
return f.getInputStream();
}
}
if (isRemote(url)) {
LOG.log(Level.FINE, "opening network stream: {0}", url);
}
final URLConnection c = url.openConnection();
c.setConnectTimeout(REMOTE_CONNECTION_TIMEOUT);
return c.getInputStream();
} finally {
if (progress != null) {
progress.finish();
}
}
}
示例13: findAndRunAction
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
/**
* Find action by display name and run it.
*/
@NbBundle.Messages({
"LBL_SearchingRecentResult=Searching for a Quick Search Item",
"MSG_RecentResultNotFound=Recent Quick Search Item was not found."})
private void findAndRunAction() {
final AtomicBoolean cancelled = new AtomicBoolean(false);
ProgressHandle handle = ProgressHandleFactory.createHandle(
Bundle.LBL_SearchingRecentResult(), new Cancellable() {
@Override
public boolean cancel() {
cancelled.set(true);
return true;
}
});
handle.start();
ResultsModel model = ResultsModel.getInstance();
Task evaluate = CommandEvaluator.evaluate(
stripHTMLandPackageNames(name), model);
RP.post(evaluate);
int tries = 0;
boolean found = false;
while (tries++ < 30 && !cancelled.get()) {
if (checkActionWasFound(model, true)) {
found = true;
break;
} else if (evaluate.isFinished()) {
found = checkActionWasFound(model, false);
break;
}
}
handle.finish();
if (!found && !cancelled.get()) {
NotifyDescriptor nd = new NotifyDescriptor.Message(
Bundle.MSG_RecentResultNotFound(),
NotifyDescriptor.INFORMATION_MESSAGE);
DialogDisplayer.getDefault().notifyLater(nd);
}
}
示例14: doWithProgress
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public static <T> T doWithProgress(String message, final Callable<? extends T> run) throws InvocationTargetException {
final ProgressPanel panel = new ProgressPanel();
panel.setCancelVisible(false);
panel.setText(message);
ProgressHandle handle = ProgressHandleFactory.createHandle(null);
JComponent progress = ProgressHandleFactory.createProgressComponent(handle);
handle.start();
final List<T> result = new ArrayList<T>(1);
final List<Exception> exception = new ArrayList<Exception>(1);
try {
Task task = RequestProcessor.getDefault().post(new Runnable() {
public void run() {
if (!SwingUtilities.isEventDispatchThread()) {
try {
result.add(run.call());
exception.add(null);
} catch (Exception e) {
result.add(null);
exception.add(e);
} finally {
SwingUtilities.invokeLater(this);
}
} else {
panel.close();
}
}
});
panel.open(progress);
task.waitFinished();
} finally {
handle.finish();
}
Exception inner = exception.get(0);
if (inner != null) {
throw new InvocationTargetException(inner, inner.getMessage());
}
return result.get(0);
}
示例15: run
import org.netbeans.api.progress.ProgressHandle; //导入方法依赖的package包/类
public void run() {
ProgressHandle ph = ProgressHandleFactory.createHandle(
NbBundle.getMessage(RetrieverEngineImpl.class,"LBL_PROGRESSBAR_Retrieve_XML"),
new Cancellable(){
public boolean cancel() {
synchronized(RetrieverEngineImpl.this){
if(!RetrieverEngineImpl.this.STOP_PULL){
RetrieverEngineImpl.this.STOP_PULL = true;
//taskThread.interrupt();
}
}
return true;
}
}, new AbstractAction(){
public void actionPerformed(ActionEvent e) {
getOPWindow().setOutputVisible(true);
getOPWindow().select();
}
});
ph.start();
ph.switchToIndeterminate();
try{
pullRecursively();
}finally{
ph.finish();
}
}