问题描述
我想在三角形中创建组合框。
所以我开始添加一个文本框。
I want to create combobox in trimbars.So I started with adding a text box.
我创建了TrimBars-> WindowTrim-> Toolbar-> Tool Control
I created TrimBars->WindowTrim->Toolbar->Tool Control
我提到类URI也
public class SearchToolItem {
@PostConstruct
public void createControls(Composite parent) {
parent.setLayout(new GridLayout());
final Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
Text text = new Text(comp, SWT.BORDER);
text.setMessage("Search");
text.setToolTipText("search");
System.out.println("i am in SearchToolItem ");
GridData lGridData = new GridData(GridData.FILL, GridData.FILL, true, true);
lGridData.widthHint = 200;
text.setLayoutData(lGridData);
}
}
我还把Sysout放在方法中,但是这种方法从来没有被执行。
I also put Sysout in method, but this method never gets executed.
我在vogella网站中提到的一样。
I did same as mentioned in vogella site
请参见第30.2节
@ greg-449
我删除了更改父布局,
以下是应用程序的trimBars部分代码.e4xmi
@greg-449I have removed changing of parent layout,below is the trimBars portion code of Application .e4xmi
<trimBars xmi:id="_MWSIoJgaEeKJoJcmiy2C6w" elementId="org.eclipse.emf.ecp.e4.application.trimbar.0">
<children xsi:type="menu:ToolBar" xmi:id="_np7_0NHfEeSckszzmbNB_g" elementId="com.gide.sasm.application.toolbar.0">
<children xsi:type="menu:ToolControl" xmi:id="_eGZ0ENHfEeSckszzmbNB_g" elementId="com.gide.sasm.application.toolcontrol.searchTool" accessibilityPhrase="" contributionURI="bundleclass://com.gide.sasm.cardprofile.model.viewmodel/com.gide.sasm.toolbar.handler.SearchToolItem"/>
</children>
</trimBars>
在runnig应用程序后,我可以看到trimBars,但是我的文本字段不存在。
待渲染和可见设置为true。
有更多的条目需要,其他的还有,我还缺少一些东西。
After runnig application I can see trimBars but my text field is not present."To Be Rendered" and "visible" are set to true.Is there some more entry needed, some where else also, am I missing something.
推荐答案
你的ToolControl必须在窗口修剪,而不是在工具栏。
Your ToolControl have to be in the Window Trim, not in the ToolBar.
这篇关于Eclipse e4工具在三角形中控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!