本文整理汇总了Java中org.openide.util.Task.isFinished方法的典型用法代码示例。如果您正苦于以下问题:Java Task.isFinished方法的具体用法?Java Task.isFinished怎么用?Java Task.isFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.Task
的用法示例。
在下文中一共展示了Task.isFinished方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postUpdate
import org.openide.util.Task; //导入方法依赖的package包/类
public Task postUpdate() {
Task t = initTask;
if (t != null && t.isFinished()) {
scheduleUpdate();
return t;
}
if (t == null) {
return initTask = KeymapModel.RP.post(new Runnable() {
public void run() {
// just initialize
mutableModel.getCategories();
mutableModel.getItems("");
scheduleUpdate();
}
});
} else if (t.isFinished()) {
scheduleUpdate();
}
return t;
}
示例2: findAndRunAction
import org.openide.util.Task; //导入方法依赖的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);
}
}