需求:因为TC的Command执行操作是,是另起一个线程,那么该怎么知道它是否结束该线程了?
解决方法,给Command添加一个监听事件
isCommandFinish = true; if(deleteTcContextList.size()> 0){ isCommandFinish = false; AIFComponentContext[] tcContexts = new AIFComponentContext[deleteTcContextList.size()]; tcContexts = deleteTcContextList.toArray(tcContexts); DeleteCommand deleteCommand = new DeleteCommand(tcContexts,app.getDesktop()); deleteCommand.addCommandListener(new ICommandListener() { @Override public void commandStarting(ICommandListenerEvent paramICommandListenerEvent) { // TODO Auto-generated method stub System.out.println("command开始!!"); } @Override public void commandDone(ICommandListenerEvent paramICommandListenerEvent) { // TODO Auto-generated method stub isCommandFinish = true; } }); deleteCommand.executeModeless();
}