Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 工具栏EclipseRCP应用程序中的文本框_Java_Eclipse_Rcp_E4 - Fatal编程技术网

Java 工具栏EclipseRCP应用程序中的文本框

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

我试图在Application.e4xmi中Eclipse RCP应用程序的按钮之后的工具栏中添加一个搜索字段,但它不起作用。我创建了一个带有处理程序的ToolControl:

@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”中指定。