Some toolbar items are missing when part size is too narrow [message #494945] |
Tue, 03 November 2009 11:10 |
|
Hi all,
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(SW T.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.B EGINNING,
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.
Thanks & Regards,
Setya
|
|
|
Re: Some toolbar items are missing when part size is too narrow [message #495073 is a reply to message #494945] |
Tue, 03 November 2009 17:15 |
Rüdiger Herrmann Messages: 581 Registered: July 2009 |
Senior Member |
|
|
it looks like you found a bug. Please file a bugzilla so tahtwe can
track this issue.
Setya wrote:
> Hi all,
>
> 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(SW T.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.B EGINNING,
> 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.
>
>
> Thanks & Regards,
>
> Setya
|
|
|
|
Powered by
FUDForum. Page generated in 0.03784 seconds