GEF--选择板的刷新

      开发Bug库 2005-8-27 9:50
在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();
	}
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}