本文整理汇总了Java中org.openide.util.Task.addTaskListener方法的典型用法代码示例。如果您正苦于以下问题:Java Task.addTaskListener方法的具体用法?Java Task.addTaskListener怎么用?Java Task.addTaskListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.Task
的用法示例。
在下文中一共展示了Task.addTaskListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ProxyTask
import org.openide.util.Task; //导入方法依赖的package包/类
public ProxyTask(Collection<? extends Task> waitFor) {
super(null);
this.cnt = waitFor.size();
notifyRunning();
for (Task t : waitFor) {
t.addTaskListener(this);
}
}
示例2: HoldInstance
import org.openide.util.Task; //导入方法依赖的package包/类
public HoldInstance (DataObject source, InstanceCookie cookie) {
this.cookie = cookie;
this.source = source;
if (cookie instanceof Task) {
// for example FolderInstance ;-) attach itself for changes
// in the cookie
Task t = (Task)cookie;
t.addTaskListener(WeakListeners.create(TaskListener.class, this, t));
}
}
示例3: shutdown
import org.openide.util.Task; //导入方法依赖的package包/类
/**
* Must be called on JShell shutdown to clean up resources. Should
* be called after all
*/
public Task shutdown() throws IOException {
Task t = shellSession.closeSession();
t.addTaskListener((e) -> {
postCloseCleanup();
});
return t;
}
示例4: reloadDocument
import org.openide.util.Task; //导入方法依赖的package包/类
@Override
protected Task reloadDocument(){
Task tsk = super.reloadDocument();
tsk.addTaskListener(new TaskListener(){
public void taskFinished(Task task){
myEntry.getHandler().autoParse();
}
});
return tsk;
}
示例5: redefineLayout
import org.openide.util.Task; //导入方法依赖的package包/类
public static void redefineLayout(Project p, JButton toEnable) {
try {
AtomicReference<FileObject> userDir = new AtomicReference<FileObject>();
Task task = invokeDesignMode(p, userDir);
if (task == null) {
toEnable.setEnabled(true);
}
task.addTaskListener(new DesignSupport(p, toEnable, userDir));
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例6: showDetail
import org.openide.util.Task; //导入方法依赖的package包/类
/**
* Shows the search detail on the DataObject.
* The document is opened in the editor, the caret is positioned on the
* right line and column and searched string is marked.
*
* @param how indicates how to show detail.
* @see #DH_GOTO
* @see #DH_SHOW
* @see #DH_HIDE */
@NbBundle.Messages({
"MSG_CannotShowTextDetai=The text match cannot be shown."
})
public void showDetail(final int how) {
prepareLine();
if (lineObj == null) {
Toolkit.getDefaultToolkit().beep();
EditCookie ed = dobj.getLookup().lookup(EditCookie.class);
if (ed != null) {
ed.edit();
showAfterDataObjectUpdated = true; // show correct line later
}
return;
}
if (how == DH_HIDE) {
return;
}
final EditorCookie edCookie = dobj.getLookup().lookup(EditorCookie.class);
if (edCookie != null) {
Task prepareTask = edCookie.prepareDocument(); //#227989
prepareTask.addTaskListener(new TaskListener() {
@Override
public void taskFinished(Task task) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
edCookie.open();
showLine(how);
highlightDetail(edCookie);
}
});
}
});
} else {
showLine(how);
}
SearchHistory.getDefault().add(
SearchPattern.create(
searchPattern.getSearchExpression(),
searchPattern.isWholeWords(), searchPattern.isMatchCase(),
searchPattern.isRegExp()));
}