Dynamically resizing action in viewer [message #718969] |
Thu, 25 August 2011 12:51  |
Eclipse User |
|
|
|
Hello,
I have a toolbar with an action in it. The text on the action changes when the user clicks on it. So what happens is that initially the text is only 8 characters, but when the user clicks on it, the length of the text increases to 15 characters. If the user clicks on it again, the text will return back to 8 characters. The action is right justified on the toolbar.
Normally I'd expect the button to resize to the left so the entire text can display, but it hasn't been doing so. Instead the button just disappears.
I tried doing a refresh on the viewer itself, but that doesn't cause the button to reappear.
Does anyone have any suggestions for how I can resolve this issue?
Thanks!
-upal
|
|
|
|
Re: Dynamically resizing action in viewer [message #719996 is a reply to message #719518] |
Mon, 29 August 2011 12:24  |
Eclipse User |
|
|
|
Hi Gator,
Thanks so much for your response. I think I might have just figured the issue out.
Here's what I did to get the actions into the toolbar:
IActionBars bars = getViewSite().getActionBars();
bars.getToolBarManager().add(myAction);
myAction was implemented the same way that you had listed and yes I was changing the text of myAction inside the run().
What I had to do to get the action to resize dynamically was the following:
IActionBars bars = getViewSite().getActionBars();
bars.getToolBarManager().update(true);
In hindsight, this seems like the obvious thing to do, but I guess at the time I hadn't thought to look at the other methods for the tool bar manager.
Hope this helps someone out.
-upal
|
|
|
Powered by
FUDForum. Page generated in 0.60918 seconds