Source:
<code>protected void createStatesGroup(@Nullable Composite composite) { if (composite == null) { return; } StateItem[] stateItems = getPresentationProvider().getStateTable(); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL); Composite innerComposite = new Composite(sc, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 20; layout.marginBottom = 10; sc.setLayout(layout); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setLayoutData(gd); innerComposite.setLayout(layout); innerComposite.setLayoutData(gd); Group running = new Group(innerComposite, SWT.NONE); <START> running.setLayout(layout); <END> running.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); running.setText(Messages.CriticalPathLegend_running); new LegendEntry(running, stateItems[0]); Group blocked = new Group(innerComposite, SWT.NONE); blocked.setLayout(layout); blocked.setLayoutData(gd); Composite blockedComposite = new Composite(blocked, SWT.NONE); blockedComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); blockedComposite.setLayoutData(gd); blocked.setText(Messages.CriticalPathLegend_blocked); for (int i = 1; i < stateItems.length; i++) { new LegendEntry(blockedComposite, stateItems[i]); } sc.setContent(innerComposite); sc.setMinSize(innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }</code><technical_language>need create a new layout instance</technical_language>

Target:
protected void createStatesGroup(@Nullable Composite composite) { if (composite == null) { return; } StateItem[] stateItems = getPresentationProvider().getStateTable(); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL); Composite innerComposite = new Composite(sc, SWT.NONE); sc.setLayout(GridLayoutFactory.swtDefaults().margins(20, 0).create()); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setLayoutData(gd); innerComposite.setLayout(GridLayoutFactory.swtDefaults().margins(0, 0).create()); innerComposite.setLayoutData(gd); Group running = new Group(innerComposite, SWT.NONE); running.setLayout(GridLayoutFactory.swtDefaults().create()); running.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); running.setText(Messages.CriticalPathLegend_running); new LegendEntry(running, stateItems[0]); Group blocked = new Group(innerComposite, SWT.NONE); blocked.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); blocked.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, true).create()); blocked.setText(Messages.CriticalPathLegend_blocked); for (int i = 1; i <= stateItems.length / 2; i++) { LegendEntry lefty = new LegendEntry(blocked, stateItems[i]); lefty.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER).create()); LegendEntry righty = new LegendEntry(blocked, stateItems[i + stateItems.length / 2]); righty.setLayoutData(GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).grab(true, false).create()); } if ((stateItems.length % 2) == 0) { LegendEntry lastOne = new LegendEntry(blocked, stateItems[stateItems.length - 1]); lastOne.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER).create()); } sc.setContent(innerComposite); sc.setMinSize(innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }