Reputation: 5062
I have an Eclipse 3.8 RCP application that runs on the Eclipse 4.4 platform using the compatibility layer. In the toolbar there is a search text which looks like this:
But when I run the application on Eclipse 4.6 it looks like this:
The search text is added via the following extension point in the plugin.xml
:
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.trim.command2">
<toolbar id="search.toolbar">
<control
class="app.SearchText"
id="app.SearchText">
</control>
</toolbar>
</menuContribution>
</extension>
The SearchText
class looks like this:
public class SearchText extends WorkbenchWindowControlContribution {
// ...
@Override
protected Control createControl(Composite parent) {
parent.setLayout(new FillLayout());
log.trace("create search text control");
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = 5;
layout.marginHeight = 0;
layout.marginWidth = 5;
layout.verticalSpacing = 0;
composite.setLayout(layout);
text = new Text(composite, SWT.BORDER | SWT.SEARCH);
// ...
return composite;
}
// ...
I played with the layout parameters but with no success and I have no idea how this could be fixed. Thanks for any help on this!
Upvotes: 2
Views: 1012
Reputation: 5062
For Eclipse Oxygen (4.7) the following workaround posted on this issue worked for me:
public class MyWorkbenchWindowControlContribution extends
WorkbenchWindowControlContribution {
@Override
protected Control createControl(Composite parent) {
parent.getParent().setRedraw(true);
....
}
@Override
public boolean isDynamic() {
return true;
}
...
Upvotes: 2
Reputation: 8100
I reported a bug a while ago: main toolbar control contributions is cut off
Here is a workaround:
The class should extend ControlContribution
instead of WorkbenchWindowControlContribution
.
In the YourApplicationNameActionBarAdvisor.fillCoolBar()
(replace the YourApplicationName) add: toolbar.add(new SearchText());
Here the print screens of the reported bug, must be the same issue.
Test with Eclipse Luna (4.4.2)
Test with Eclipse Mars (4.5.0)
Upvotes: 1