CoolBar ContributionItem ignored in E4 [message #1116504] |
Wed, 25 September 2013 10:31  |
Eclipse User |
|
|
|
Hey!
I'm struggling with some issues with migrating our RCP based application from eclipse 3.8 to 4.3. One of them, for which i could not find a bug so far, is that we have a ContributionItem that be add to the CoolBarManager in ActionBarAdvisor's fillCoolBar. This contribution tries to "inject" a composite /above/ the toolbar:
private static class HeaderContribution extends ContributionItem {
// when creating/switching perspectives we are not allowed to
// re-create the header contribution because
// of the bad hacks that are done to get the image on the top
private boolean created = false;
@Override
public void fill(CoolBar parent, int index) {
if (created) {
return;
}
created = true;
GridLayout gl = new GridLayout(1, false);
gl.marginWidth = 0;
gl.marginHeight = 0;
Composite logo = new Composite(parent.getParent(), SWT.NO_FOCUS);
// Some more hack to get it before a coolbar
parent.getParent().setLayout(gl);
final Shell s = new Shell();
s.setText("ApplicationActionBar");
parent.setParent(s);
final GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
gd.heightHint = 22;
gd.verticalIndent = 0;
gd.horizontalIndent = 0;
logo.setLayoutData(gd);
GridLayout rl = new GridLayout(1, false);
rl.marginHeight = 0;
rl.marginWidth = 0;
rl.horizontalSpacing = 0;
rl.verticalSpacing = 0;
rl.marginTop = 3;
rl.marginRight = 15;
logo.setLayout(rl);
logo.setBackground(ColorHandler.getSchaeferYellow());
final Label icon = new Label(logo, SWT.FLAT);
icon.setBackground(logo.getBackground());
icon.setImage(ImageProvider.getImage(getLogoDescriptor()));
final GridData igd = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
igd.horizontalIndent = 0;
igd.verticalIndent = 0;
icon.setLayoutData(igd);
parent.setParent(logo.getParent());
parent.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
}
private ImageDescriptor getLogoDescriptor() {
...
}
}
now, i /do/ know that it was a bad hack in the first place . attached is a screenshot of how this should look like (and does with 3. . With 4.3, the fill method is not even called. i suspect this is due to TrimBar not supporting arbitrary contributions?
what could i do to get the same look back?
Thanks!
|
|
|
Re: CoolBar ContributionItem ignored in E4 [message #1118291 is a reply to message #1116504] |
Fri, 27 September 2013 04:58  |
Eclipse User |
|
|
|
never mind. i managed to do it by using a model processor that registers a APP_STARTUP_COMPLETE handler on the IEventBroker. in this handler im processing the model, adding a ToolControl to the top trimbar at postition zero. the implementation for this control uses a normal composite to draw the bar.
|
|
|
Powered by
FUDForum. Page generated in 0.04339 seconds