Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » CoolBar ContributionItem ignored in E4
CoolBar ContributionItem ignored in E4 [message #1116504] Wed, 25 September 2013 14:31 Go to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
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 Wink . attached is a screenshot of how this should look like (and does with 3.Cool. 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 08:58 Go to previous message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
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.
Previous Topic:Adding Key Binding to Command
Next Topic:How to use databinding between widget and List nested in model object
Goto Forum:
  


Current Time: Tue Mar 19 03:41:23 GMT 2024

Powered by FUDForum. Page generated in 0.02207 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top