Reputation: 85
I am trying to add a search field in the toolbar after my buttons of my Eclipse RCP Application from the Application.e4xmi , but it doesn't work. I created a ToolControl with a handler :
@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);
}
How should I do this?
Upvotes: 0
Views: 551
Reputation: 111142
I assume you are specifying this class as a ToolControl
in the e4xmi.
ToolControls don't use @Execute
and they aren't given a Shell
.
Instead use @PostConstruct
and specify a Composite
:
@PostConstruct
public void postConstruct(Composite parent)
{
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
....
}
Note: Do not change the layout for the parent composite.
Upvotes: 1