zoukankan      html  css  js  c++  java
  • Eclipse RCP开发(四):填充界面

    原文链接:https://blog.csdn.net/vking_wang/article/details/8716073

    添加菜单栏

    1)首先在WorkbenchWindowAdvisor中显示菜单栏

    @Override
    public void preWindowOpen() {
            IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
            configurer.setInitialSize(new Point(400, 300));
            configurer.setShowCoolBar(false);
            configurer.setShowMenuBar(true);//显示菜单栏
            configurer.setShowStatusLine(true);
            configurer.setTitle("Hello RCP"); 
        }

    2)在ActionBarAdvisor中添加动作

    public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
        
        private IWorkbenchAction exitAction;
        private IWorkbenchAction aboutAction;
     
        public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
            super(configurer);
        }
     
        @Override
        protected void makeActions(IWorkbenchWindow window) {
            exitAction = ActionFactory.QUIT.create(window);
            aboutAction = ActionFactory.ABOUT.create(window);
            
            register(exitAction);
            register(aboutAction);
        }
     
        @Override
        protected void fillMenuBar(IMenuManager menuBar) {
            MenuManager fileMenuMgr = new MenuManager("&File", "File");
            fileMenuMgr.add(exitAction);
            
            MenuManager helpMenuMgr = new MenuManager("&Help", "Help");
            helpMenuMgr.add(aboutAction);
            
            menuBar.add(fileMenuMgr);
            menuBar.add(helpMenuMgr);
        }
        
    }

    现在的界面如下:

    添加工具栏

    1)在WorkbenchWindowAdvisor中显示工具栏

    configurer.setShowCoolBar(true);

    2)在ActionBarAdvisor中添加动作

        @Override
        protected void fillCoolBar(ICoolBarManager icoolbarmanager){
            IToolBarManager toolbar = new ToolBarManager(icoolbarmanager.getStyle());
            icoolbarmanager.add(toolbar);
            toolbar.add(aboutAction);
            toolbar.add(exitAction);
        }

    现在的界面如下:

    添加状态栏

    1)在WorkbenchWindowAdvisor中显示状态栏

    configurer.setShowStatusLine(true);

    2)在WorkbenchWindowAdvisor中添加动作

        @Override
        public void postWindowOpen(){
            IStatusLineManager statusLine = getWindowConfigurer().
                    getActionBarConfigurer().
                    getStatusLineManager();
            statusLine.setMessage("-login : "+new Date().toLocaleString());
        }

    现在的界面如下:

  • 相关阅读:
    fiddler中的HexView的16进制数据转明文
    安卓逆向分析韵达超市app接口及其实现
    安卓逆向分析百世来取app接口及其实现
    安卓逆向-快宝驿站
    安卓逆向-工具篇
    记录celery启动时出现bug
    python微信拼手气红包逻辑
    检测函数运行时间
    Python获取硬件信息(硬盘序列号,CPU序列号)
    sorted&filter&map
  • 原文地址:https://www.cnblogs.com/lotuses/p/11561640.html
Copyright © 2011-2022 走看看