| Summary: | [ToolBar] Some toolbar items are missing when part is resized too narrowly | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Setya Nugdjaja <jsetya> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | ||
| Version: | 1.3 | ||
| Target Milestone: | 1.3 M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Steya, I can reproduce it with your snippet. Is this working in RCP? Hi, Thank you for investigating. I've just tried the snippet on RCP. It works fine there. Regards, Setya Steya, if I remove form your snippet (setting toolbar layout): --- parent.setLayout(GridLayoutFactory.fillDefaults().create()); --- form ControlContribution#createControl() method, everything is working as expected. Can you confirm this? BTW... in RAP the ToolBar does not support SWT.WRAP style. (In reply to comment #3) > Steya, if I remove form your snippet (setting toolbar layout): > --- > parent.setLayout(GridLayoutFactory.fillDefaults().create()); > --- > form ControlContribution#createControl() method, everything is working as > expected. > Can you confirm this? Yes, It works as expected if setting toolbar layout is removed. Regards, Setya Setya, what is the use case of setting ToolBar layout to GridLayout. Using the snippet above: --- parent.setLayout(GridLayoutFactory.fillDefaults().create()); --- will create a single column grid layout. Actually in RAP when you resize the view part the GridLayout correctly positions all the ToolItem.SEPARATOR controls in one column :-) - only first is visible, rest are out of ToolBar height. I think that SWT behaves wrong in this case and the bug is invalid. When ToolBar is resized the ToolItem control bounds are recalculated too. Fixed in CVS HEAD. |
Using the following snippet I can reproduce problems with contribution item when part is resized. @Override public void createPartControl(Composite parent) { parent.setLayout(GridLayoutFactory.fillDefaults().create()); final IToolBarManager toolbarManager = new ToolBarManager(SWT.FLAT | SWT.WRAP | SWT.HORIZONTAL); ToolBar toolbar = ((ToolBarManager)toolbarManager).createControl(parent); toolbar.setLayoutData(GridDataFactory.swtDefaults().align(SWT.END, SWT.TOP).grab(true, false).create()); toolbarManager.add(new Separator("dynamic")); toolbarManager.add(new Separator("static")); IAction action = new Action("Add") { @Override public String getId(){return "action.add";} @Override public void run() { IContributionItem contributionItem = new ControlContribution("item" + (++counter)) { @Override protected Control createControl(Composite parent) { parent.setLayout(GridLayoutFactory.fillDefaults().create()); Text text = new Text(parent,SWT.NONE); text.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER).hint(SWT.DEFAULT, 16).create()); return text; } }; toolbarManager.appendToGroup("dynamic", contributionItem); toolbarManager.update(true); } }; toolbarManager.appendToGroup("static", action); action = new Action("Remove") { @Override public String getId(){return "action.remove";} @Override public void run() { if (counter == 0) return; toolbarManager.remove("item" + (counter--)); toolbarManager.update(true); } }; toolbarManager.appendToGroup("static", action); toolbarManager.update(true); } Step to reproduce: 1. Add some contribution items (by clicking 'Add' action). 2. Resize part until it's not wide enough to display all the items. 3. At this point we can observe that some text boxes are missing. 4. When part is resized back, the missing text boxes are still missing. Regards, Setya