Java 工具栏EclipseRCP应用程序中的文本框
我试图在Application.e4xmi中Eclipse RCP应用程序的按钮之后的工具栏中添加一个搜索字段,但它不起作用。我创建了一个带有处理程序的ToolControl:Java 工具栏EclipseRCP应用程序中的文本框,java,eclipse,rcp,e4,Java,Eclipse,Rcp,E4,我试图在Application.e4xmi中Eclipse RCP应用程序的按钮之后的工具栏中添加一个搜索字段,但它不起作用。我创建了一个带有处理程序的ToolControl: @Execute public void execute(Shell shell) { shell.setLayout(new GridLayout()); final Composite comp = new Composite(shell, SWT.NONE); comp
@Execute
public void execute(Shell shell)
{
shell.setLayout(new GridLayout());
final Composite comp = new Composite(shell, 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);
}
我该怎么做
我假设您在e4xmi中将此类指定为
工具控件
ToolControls不使用@Execute
,也没有为它们提供Shell
相反,使用@PostConstruct
并指定一个组合:
@PostConstruct
public void postConstruct(Composite parent)
{
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
....
}
注意:请勿更改父组合的布局。现在出现了工具栏,但它给了我一个异常:无法处理“GotolkHandler#postConstruct()”:未找到参数“composite”的实际值。这是e4xmi中的ToolControl还是命令处理程序?此代码仅适用于ToolControl。编辑你的问题,准确地输入你想要使用的内容。这是一个ToolControl你所说的“带处理程序的ToolControl”是什么意思?此类应在ToolControl定义的“类URI”中指定。