0
我在嘗試更新GEF的模型,並在創建的視圖中顯示更改。目前沒有改變我提出的是反映在該視圖中,我使用下面的方法來更新模型,我想知道,如果它的正確的做法採取:從後臺線程更新GEF模型
Display.getDefault().asyncExec(new Runnable() {
public void run() {
String viewId = "beat.views.BeatView";
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow mainWindow = workbench
.getActiveWorkbenchWindow();
try {
BeatView view = (BeatView) mainWindow.getActivePage()
.showView(viewId);
BeatEditPart beatEditPart = (BeatEditPart)view.getGraphicalViewer().getContents();
BeatModel beatModel = (BeatModel)beatEditPart.getModel();
beatModel.setObjects(model);
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});