9910

单飞

   :: 首页 :: 联系 :: 聚合  :: 管理
    public static void hidePropertiesView() {
        hideView("org.eclipse.ui.views.PropertySheet");
    }

    public static void hideView(final String theViewId) {
        invokeOnDisplayThread(new Runnable() {
            public void run() {
                try {
                    IWorkbenchPage activePage = getActivePage();
                    IViewPart iviewpart = activePage.findView(theViewId);
                    activePage.hideView(iviewpart);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    public static void invokeOnDisplayThread(Runnable runnable) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow windows[] = workbench.getWorkbenchWindows();
        if (windows != null && windows.length > 0) {
            Display display = windows[0].getShell().getDisplay();
            display.syncExec(runnable);
        } else {
            runnable.run();
        }
    }


posted on 2009-08-03 11:29 单飞 阅读(653) 评论(0)  编辑  收藏 所属分类: Eclipse Plugin

只有注册用户登录后才能发表评论。


网站导航: