在GEF中,曾经研究过很长时间怎样动态刷新。刚刚做出来,分享。
public static IWorkbenchPage getActivePage() {
if (SimulatorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()==null){
return null;
}
return SimulatorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
static public EditPartViewer getActiveViewer() {
return ((SimulatorEditor) getActivePage().getActiveEditor()).getViewer();
}
/**
* @author sawxb
* @return
*/
static public DefaultEditDomain getEditDomain() {
return (DefaultEditDomain) getActiveViewer().getEditDomain();
}
/**
* @author sawxb
* @return
*/
static public void setPaletteRoot() {
PaletteRoot root = SimulatorPlugin.createPalette();
getEditDomain().setPaletteRoot(root);
}
/**
* @author sawxb
*
*/
static public void refreshPalette() {
setPaletteRoot();
}
|
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}