1

I am working on modifying EGit for an use case. The current state looks like the following: enter image description here

I now want to add an image next to the title text of the unstaged section i.e. next to "Unstaged Changes (0)". Check the following for reference: enter image description here

I am not looing to add image to the toolbar, but next to the text.

Check the following code for the current unstaged section:

    Section unstagedSection;
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    unstagedSection = toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);

    unstagedSection.setText("Unstaged Changes" + " (0)"); //$NON-NLS-1$
    unstagedSection.clientVerticalSpacing = 0;

    GridDataFactory.fillDefaults().grab(true, false).applyTo(unstagedSection);

    Composite unstagedComposite = toolkit.createComposite(unstagedSection);
    toolkit.paintBordersFor(unstagedComposite);
    GridLayoutFactory.fillDefaults().applyTo(unstagedComposite);
    unstagedSection.setClient(unstagedComposite);

I want to know if it is possible to add the image next to the title text of the Section and how?.

Any kind of help will be appreciated. Thanks.

Edit 1: I have reached till this point. The only thing I need to know is how to put it right after the text.

enter image description here

rayobanon
  • 43
  • 1
  • 7
  • The only thing is Section.setTextClient which it looks like you are already using for the toolbar and puts things at the far right. – greg-449 May 08 '22 at 06:58
  • Yes exactly. But can I add multiple toolbars and align one to start at the end of the text? – rayobanon May 16 '22 at 13:03

0 Answers0