• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TaskListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openide.util.TaskListener的典型用法代码示例。如果您正苦于以下问题:Java TaskListener类的具体用法?Java TaskListener怎么用?Java TaskListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TaskListener类属于org.openide.util包,在下文中一共展示了TaskListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: performAction

import org.openide.util.TaskListener; //导入依赖的package包/类
public void performAction(Node[] nodes) {
    JAXBWizardSchemaNode schemaNode = 
            nodes[0].getLookup().lookup(JAXBWizardSchemaNode.class);
    if (schemaNode != null){
        Schema schema = schemaNode.getSchema();
        final Project prj = schemaNode.getProject();
        ProjectHelper.deleteSchemaFromModel(prj, schema);
        ProjectHelper.cleanupLocalSchemaDir(prj, schema);
        ProjectHelper.cleanCompileXSDs(prj, false, new TaskListener() {
            
            @Override
            public void taskFinished( Task arg0 ) {
                ProjectHelper.checkAndDeregisterScript(prj);
            }
        });
    }        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JAXBDeleteSchemaAction.java


示例2: setResult

import org.openide.util.TaskListener; //导入依赖的package包/类
private synchronized void setResult(final Union2<ExecutorTask,Throwable> result) {
    this.result = result;
    if (result.hasFirst()) {
        result.first().addTaskListener(new TaskListener() {
            @Override
            public void taskFinished(Task task) {
                callBack.get().run();
            }
        });
        if (stopped) {
            result.first().stop();
        }
    } else {
        callBack.get().run();
    }
    this.notifyAll();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ProjectRunnerImpl.java


示例3: scheduleRefreshProviders

import org.openide.util.TaskListener; //导入依赖的package包/类
private static void scheduleRefreshProviders () {
    refreshUpdateCenters (null);
    final int delay = 500;
    final long startTime = System.currentTimeMillis ();
    RequestProcessor.Task t = Installer.RP.post (doCheckAvailableUpdates, delay);
    t.addTaskListener (new TaskListener () {
        @Override
        public void taskFinished (Task task) {
            task.removeTaskListener (this);
            long time = (System.currentTimeMillis () - startTime - delay) / 1000;
            if (time > 0) {
                Utilities.putTimeOfInitialization (time);
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AutoupdateCheckScheduler.java


示例4: setEnabled

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
public void setEnabled (boolean enabled) {
    if (isEnabled () != enabled) {
        if (enabled) {
            RequestProcessor.Task t = PluginManagerUI.getRunningTask (new Runnable () {

                @Override
                public void run() {
                    setEnabled (true);
                }
            });
            if (t != null && ! t.isFinished ()) {
                t.addTaskListener (new TaskListener () {
                    @Override
                    public void taskFinished (org.openide.util.Task task) {
                        setEnabled (true);
                    }
                });
            } else {
                super.setEnabled (true);
            }
        } else {
            super.setEnabled (false);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:UnitTab.java


示例5: setUpApplyChecker

import org.openide.util.TaskListener; //导入依赖的package包/类
private void setUpApplyChecker(final OptionsPanel optsPanel) {
final RequestProcessor.Task applyChecker = RP.post(new Runnable() {
    @Override
    public void run() {
               SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                       if (!savingInProgress) {
                           bAPPLY.setEnabled(optsPanel.isChanged() && optsPanel.dataValid());
                       }
                   }
               });
    }
});
applyChecker.addTaskListener(new TaskListener() {
    @Override
    public void taskFinished(Task task) {
	if (dialog != null) {
	    applyChecker.schedule(DELAY);
	}
    }
});
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:OptionsDisplayerImpl.java


示例6: actionPerformed

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
    public void actionPerformed(ActionEvent ev) {
        final Dialog d = BusyDialog.getBusyDialog();
        
        RequestProcessor.Task T = RequestProcessor.getDefault().post(new checkCleanRunnable());
        T.addTaskListener(new TaskListener() {

            @Override
            public void taskFinished(Task task) {
//                d.setVisible(false);
                if(esito)   {                
                    StatusBar.setStatus(Bundle.MSG_STATUS_Clean(), 10,5000);
                    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
                        Bundle.MSG_CheckCleanInstanceClean(), 
                        NotifyDescriptor.INFORMATION_MESSAGE));
                }else{
                    StatusBar.setStatus(Bundle.MSG_STATUS_Violated(), 10, 5000);
                    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
                            message.toString(), 
                            NotifyDescriptor.WARNING_MESSAGE));
                }
            }
        });
//        d.setVisible(true);
    }
 
开发者ID:dbunibas,项目名称:BART,代码行数:26,代码来源:CheckCleanInstance.java


示例7: save

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
    public void save() throws IOException {
        dto = CentralLookup.getDefLookup().lookup(EGTaskDataObjectDataObject.class);
        final InputOutput io = IOProvider.getDefault().getIO(dto.getPrimaryFile().getName(), false);
        io.select();
        OutputWindow.openOutputWindowStream(io.getOut(), io.getErr());
        final Dialog d = BusyDialog.getBusyDialog();
        RequestProcessor.Task T = RequestProcessor.getDefault().post(new SaveEgtaskRunnable());
        T.addTaskListener(new TaskListener() {

            @Override
            public void taskFinished(Task task) {
//                d.setVisible(false);
                if(esito)   {
                    System.out.println(Bundle.MSG_SaveEGTask_OK(dto.getPrimaryFile().getName()));
                }else{
                    System.err.println(Bundle.MSG_SaveEGTask_Failed(dto.getPrimaryFile().getName()));                  
                }
                OutputWindow.closeOutputWindowStream(io.getOut(), io.getErr());
//                d.setVisible(false);
            }
            
        });
//        d.setVisible(true);
    }
 
开发者ID:dbunibas,项目名称:BART,代码行数:26,代码来源:SaveEGTask.java


示例8: getTaskListener

import org.openide.util.TaskListener; //导入依赖的package包/类
/**
 */
private TaskListener getTaskListener() {
    if (taskListener == null) {
        taskListener = new MyTaskListener();
    }
    return taskListener;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:Manager.java


示例9: execute

import org.openide.util.TaskListener; //导入依赖的package包/类
public ExecutorTask execute(RunConfig config, InputOutput io, TabContext tc) {
    LifecycleManager.getDefault().saveAll();
    MavenExecutor exec = new MavenCommandLineExecutor(config, io, tc);
    ExecutorTask task = ExecutionEngine.getDefault().execute(config.getTaskDisplayName(), exec, new ProxyNonSelectableInputOutput(exec.getInputOutput()));
    exec.setTask(task);
    task.addTaskListener(new TaskListener() {
        @Override
        public void taskFinished(Task t) {
            MavenProject mp = config.getMavenProject();
            if (mp == null) {
                return;
            }
            final List<Artifact> arts = new ArrayList<Artifact>();
            Artifact main = mp.getArtifact();
            if (main != null) {
                arts.add(main);
            }
            arts.addAll(mp.getArtifacts());
            UPDATE_INDEX_RP.post(new Runnable() {
                @Override
                public void run() {
                    RepositoryIndexer.updateIndexWithArtifacts(RepositoryPreferences.getInstance().getLocalRepository(), arts);
                }
            });
        }
    });
    return task;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:MavenCommandLineExecutor.java


示例10: performAction

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
protected void performAction(final Node[] activatedNodes) {
    final Collection<? extends TestMethodDebuggerProvider> providers = Lookup.getDefault().lookupAll(TestMethodDebuggerProvider.class);
    RequestProcessor RP = new RequestProcessor("TestMethodDebuggerAction", 1, true);   // NOI18N
    debugMethodTask = RP.create(new Runnable() {
        @Override
        public void run() {
            for (TestMethodDebuggerProvider provider : providers) {
                if (provider.canHandle(activatedNodes[0])) {
                    debugMethodProvider = provider;
                    break;
                }
            }
        }
    });
    final ProgressHandle ph = ProgressHandleFactory.createHandle(Bundle.Search_For_Provider(), debugMethodTask);
    debugMethodTask.addTaskListener(new TaskListener() {
        @Override
        public void taskFinished(org.openide.util.Task task) {
            ph.finish();
            if (debugMethodProvider == null) {
                StatusDisplayer.getDefault().setStatusText(Bundle.No_Provider_Found());
            } else {
                debugMethodProvider.debugTestMethod(activatedNodes[0]);
            }
        }
    });
    ph.start();
    debugMethodTask.schedule(0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:TestMethodDebuggerAction.java


示例11: performAction

import org.openide.util.TaskListener; //导入依赖的package包/类
/** This method is called by one of the "invokers" as a result of
* some user's action that should lead to actual "performing" of the action.
* This default implementation calls the assigned actionPerformer if it
* is not null otherwise the action is ignored.
*/
public void performAction ( final Node[] nodes ) {

    if (nodes.length != 1)
        return;

    // Open the diaog for bean info generation

    final BiPanel biPanel = new BiPanel();

    // Get pattern analyser & bean info and create BiAnalyser & BiNode

    FileObject javaFile = findFileObject(nodes[0]);
    final BeanInfoWorker performer = new BeanInfoWorker(javaFile, biPanel);
    
    class Task implements TaskListener, Runnable {

        public void taskFinished(org.openide.util.Task task) {
            EventQueue.invokeLater(this);
        }

        public void run() {
            if (performer.error != null) {
                DialogDisplayer.getDefault().notify(performer.error);
            }
            if (performer.bia != null) {
                performer.bia.openSource();
            }
        }
        
    }

    performer.analyzePatterns().addTaskListener(new Task());

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:GenerateBeanInfoAction.java


示例12: initialize

import org.openide.util.TaskListener; //导入依赖的package包/类
private void initialize() {
    if (!isInitialized) {
        setLayout(new BorderLayout());
        biPanel = new BiPanel();
        add(biPanel, BorderLayout.CENTER);
        isInitialized = true;
    } else {
        biPanel.setContext(new BiNode.Wait());
    }
    
    FileObject biFile = dataObject.getPrimaryFile();
    String name = biFile.getName();
    name = name.substring(0, name.length() - "BeanInfo".length()); // NOI18N
    FileObject javaFile = biFile.getParent().getFileObject(name, biFile.getExt());
    BIEditorSupport editor = findEditor(dataObject);
    if (javaFile != null) {
        final BeanInfoWorker beanInfoWorker = new GenerateBeanInfoAction.BeanInfoWorker(javaFile, biPanel);
        editor.worker = beanInfoWorker;
        beanInfoWorker.analyzePatterns().addTaskListener(new TaskListener() {

            public void taskFinished(Task task) {
                beanInfoWorker.updateUI();
            }
        });
    } else {
        // notify missing source file
        biPanel.setContext(BiNode.createNoSourceNode(biFile));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:BIEditorSupport.java


示例13: HoldInstance

import org.openide.util.TaskListener; //导入依赖的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));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:FolderInstance.java


示例14: setExecutor

import org.openide.util.TaskListener; //导入依赖的package包/类
void setExecutor(ExecutorTask execTask) {
    this.execTask = execTask;
    if (execTask != null) {
        execTask.addTaskListener(new TaskListener() {
            @Override
            public void taskFinished(org.openide.util.Task task) {
                // The ANT task was finished
                finish();
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:AntDebugger.java


示例15: reloadDocument

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
protected Task reloadDocument(){
    Task tsk = super.reloadDocument();
    tsk.addTaskListener(new TaskListener(){
        public void taskFinished(Task task){
            myEntry.getHandler().autoParse();
        }
    });
    return tsk;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:PropertiesEditorSupport.java


示例16: runTarget

import org.openide.util.TaskListener; //导入依赖的package包/类
public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props, final ActionProgress listener) {
    try {
        ActionUtils.runTarget(scriptFile, targetNameArray, props).addTaskListener(new TaskListener() {
            @Override public void taskFinished(Task task) {
                listener.finished(((ExecutorTask) task).result() == 0);
            }
        });
    } catch (IOException e) {
        ErrorManager.getDefault().notify(e);
        listener.finished(false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Actions.java


示例17: createTabForModel

import org.openide.util.TaskListener; //导入依赖的package包/类
private UnitTable createTabForModel(final UnitCategoryTableModel model) {
    final UnitTable table = new UnitTable(model);
    selectFirstRow(table);
    
    final UnitTab tab = new UnitTab(table, new UnitDetails(), this);
    if (initTask != null) {
        tab.setWaitingState(! initTask.isFinished());
        initTask.addTaskListener(new TaskListener() {

            @Override
            public void taskFinished(Task task) {
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        tab.setWaitingState(false);
                    }
                });
            }
        });
    }
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            tpTabs.add(tab, model.getTabIndex());
            decorateTabTitle(table);
        }
    });
    return table;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:PluginManagerUI.java


示例18: testWaitFinishedFromNotification

import org.openide.util.TaskListener; //导入依赖的package包/类
/** Make sure it is safe to call waitFinished() on a task from within
 * a task listener.
 */
public void testWaitFinishedFromNotification() throws Exception {
    class X implements Runnable {
        private Task task;
        private int cnt;
        public synchronized Task start() {
            if (task == null) {
                task = RequestProcessor.postRequest(this);
            }
            return task;
        }
        public void run() {
            cnt++;
        }
        public int getCount() {
            return cnt;
        }
        public void block() {
            start().waitFinished();
        }
    }
    final X x = new X();
    final Object lock = "wait for task to finish";
    final boolean[] finished = new boolean[1];
    x.start().addTaskListener(new TaskListener() {
        public void taskFinished(Task t) {
            x.block();
            finished[0] = true;
            synchronized (lock) {
                lock.notify();
            }
        }
    });
    synchronized (lock) {
        lock.wait(5000);
    }
    assertTrue(finished[0]);
    assertEquals(1, x.getCount());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:RequestProcessorTest.java


示例19: testCancel

import org.openide.util.TaskListener; //导入依赖的package包/类
/** Make sure that successfully canceled task is not performed.
 */
public void testCancel() throws Exception {
    class X implements Runnable {
        public boolean performed = false;
        public void run() {
            performed = true;
        }
    }
    
    X x = new X();
    final boolean[] finished = new boolean[1];
    finished[0] = false;
    
    // post task with some delay
    RequestProcessor.Task task = RequestProcessor.postRequest(x, 1000);
    task.addTaskListener(new TaskListener() {
        @Override
        public void taskFinished(Task t) {
            finished[0] = true;
        }
    });

    boolean canceled = task.cancel();
    assertTrue("Task is canceled now", canceled);
    assertTrue("Cancelling actually means finished", finished[0]);
    Thread.sleep(1500); // wait longer than task delay
    assertFalse("Task should not be performed", x.performed);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:RequestProcessorTest.java


示例20: actionPerformed

import org.openide.util.TaskListener; //导入依赖的package包/类
@Override
    public void actionPerformed(ActionEvent ev) {
        if ((map == null) || (map.isEmpty())) {
            DialogDisplayer.getDefault()
                    .notify(new NotifyDescriptor.Message(Bundle.MSG_NO_CHANGES(), NotifyDescriptor.INFORMATION_MESSAGE));
            return;
        }
        File toSave = chooseFile();
        if (toSave == null) return;
        if (!(toSave.getName().contains(".csv") || toSave.getName().contains(".CSV"))) {
            StringBuilder sb = new StringBuilder(toSave.getAbsolutePath());
            sb.append(".csv");
            toSave = new File(sb.toString());
        }
        final InputOutput io = IOProvider.getDefault().getIO(dtoFileName, false);
        io.select();
        OutputWindow.openOutputWindowStream(io.getOut(), io.getErr());
        final Dialog d = BusyDialog.getBusyDialog();
        final String fileName = toSave.getName();
        RequestProcessor.Task T = RequestProcessor.getDefault().post(new ExportRunnable(toSave));
        T.addTaskListener(new TaskListener() {
            @Override
            public void taskFinished(Task task) {
//                d.setVisible(false);
                if (result) {
                    System.out.println(Bundle.MSG_SAVE_OK(fileName));
                } else {
                    System.err.println(Bundle.MSG_NOT_SAVE(fileName));
                }
                OutputWindow.closeOutputWindowStream(io.getOut(), io.getErr());
            }
        });
//        d.setVisible(true);
    }
 
开发者ID:dbunibas,项目名称:BART,代码行数:35,代码来源:Export.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EventListener类代码示例发布时间:2022-05-22
下一篇:
Java VerificationData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap