Community
Participate
Working Groups
Build ID: I20070503-1400 ActionContributionItem.MODE_FORCE_TEXT only applies when the widget is a ToolItem, but not for Buttons. Currently, Buttons (created with ActionContributionItem.fill(Composite)) only display the icon -- I would like them to display both icon and text if MODE_FORCE_TEXT is given. Steps To Reproduce: ActionContributionItem item = new ActionContributionItem(new MyAction()); item.setMode(ActionContributionItem.MODE_FORCE_TEXT); item.fill(composite); More information: Indeed, currently getMode() is only called in the "if (widget instanceof ToolItem)" branch of update(), but not in the "if (widget instanceof Button)" branch.
An ActionContributionItem(IAction action, int mode) constructor would be nice too.
I would like a public getControl() [or getWidget()] method too, otherwise I cannot set layout data on the button. And/or, fill(Composite parent) could return the widget it has created.
(In reply to comment #2) > I would like a public getControl() [or getWidget()] method too, otherwise I > cannot set layout data on the button. And/or, fill(Composite parent) could > return the widget it has created. > exactly, it should be much easier than this: new ActionContributionItem(action).fill(this); Control [] children = this.getChildren(); for(int i = 0; i < children.length; i++){ if(children[i].getData instanceof ActionContributionItem){ Button button = (Button) children[i]; button.setLayoutData(...); } }
Created attachment 78914 [details] Patch to implement the requested functionality of displaying text in a Button when MODE_FORCE_TEXT is set. (In reply to comment #1) > An ActionContributionItem(IAction action, int mode) constructor would be nice > too. Paul? This doesn't sound that important to me although it would save a call to update(). (In reply to comment #2) > I would like a public getControl() [or getWidget()] method too, otherwise I > cannot set layout data on the button. And/or, fill(Composite parent) could > return the widget it has created. It'd have to be getWidget() since SWT Items aren't Controls.
The API request in comment 2 and comment 3 seems to go back to bug 36446.
Created attachment 84188 [details] Patch for HEAD Remy, please have a look. Thanx, PW
Released in HEAD >20071130 PW
The Javadoc for ActionContributionItem.MODE_FORCE_TEXT should be updated as well.
Updated the javadoc to mention buttons as well. Released to HEAD >20071203 PW
In I20071211-0010 PW