[Eclipse RCP] RCP工具栏上如何加文本框

hhtop5 2011-02-20
用的事workbenchWindow
JasonRight 2011-02-23

需要自己实现ControlContribution的子类或者ContributionItem子类并重载fill(CoolBar parent, int index)方法

@see http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/msg02727.html

我之前也没有做过,所以只是简单验证一下

//class:ApplicationActionBarAdvisor 
  
    protected void fillCoolBar(ICoolBarManager coolBar) {
        final IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
        coolBar.add(new ToolBarContributionItem(toolbar, "main"));   
        toolbar.add(openViewAction);
        toolbar.add(messagePopupAction);
        
        ControlContribution item = new ControlContribution("text in coolbar"){

			@Override
			protected Control createControl(Composite parent) {
				Text text = new Text(parent, SWT.BORDER);
				text.setText("www.iteye.com:)                                ");
				return text;
			}
        };
        
        toolbar.add(item);
    }

 

 

hhtop5 2011-02-24
很好很强大   非常感谢
shijiyu 2011-03-01
这样用代码实现很好 不过复杂了点 可以通过配置文件来实现
Neoman 2013-03-06
shijiyu 写道
这样用代码实现很好 不过复杂了点 可以通过配置文件来实现

配置文件如何实现?
Global site tag (gtag.js) - Google Analytics