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());
        }

    现在的界面如下:

  • 相关阅读:
    自己写的一个校验IP、IP掩码、IP段的方法
    JS 数组方法splice的源码探究
    element ui 的时间选择控件
    浅谈闭包
    tensorFlow-深度学习训练并行模式
    tensorflow-TensorBoard
    tensorflow-RNN和LSTM
    tensorflow-TFRecord报错ValueError: Protocol message Feature has no "feature" field.
    tensorflow-mnist报错[WinError 10060] 由于连接方在一段时间后没有正确答复解决办法
    旋转图片,增加神经网络的准确率
  • 原文地址:https://www.cnblogs.com/lotuses/p/11561640.html
Copyright © 2011-2022 走看看