Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 378844 - Change the command name/tooltip inside command callback
Summary: Change the command name/tooltip inside command callback
Status: RESOLVED WORKSFORME
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 349328
  Show dependency tree
 
Reported: 2012-05-08 10:23 EDT by Szymon Brandys CLA
Modified: 2012-05-11 06:56 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Brandys CLA 2012-05-08 10:23:18 EDT
My case is:
I have a collapse/expand command for sections. The command is a toggler that closes or opens the section. When I click the command I would like to change the name and tooltip to say respectively "Expand" or "Collapse". I would like to change it inside the command callback.
Comment 1 Szymon Brandys CLA 2012-05-08 10:24:08 EDT
Or maybe there is another way to do it Susan?
Comment 2 Susan McCourt CLA 2012-05-08 12:19:44 EDT
(In reply to comment #1)
> Or maybe there is another way to do it Susan?

There is a hack way, which is define both commands and rerender when you change state.  For example see tasks.js.  I was talking about adding the same thing for Libing with two way/inline compare and he said it was simple enough to have two commands since they did different things anyway.
Comment 3 Susan McCourt CLA 2012-05-08 12:23:08 EDT
We should also settle on terminology.  I used View/Hide in the "Create new content" list in the navigator because we don't really use a twistie/tree presentation, such as in http://store.apple.com/us/configure/MC968LL/A?select=select&product=MC968LL%2FA

So something like View/Hide seemed more appropriate.  (I'm sure I've used the expand/collapse terminology before, just thought about it a little more yesterday.)
Comment 4 Susan McCourt CLA 2012-05-08 12:25:34 EDT
see also bug 366234.
In that scenario you would put the hide and show case in the same command.  You would still rerender the commands whenever the state changed, and the visibleWhen would hammer the command name/tooltip before it rendered.
Comment 5 Szymon Brandys CLA 2012-05-08 13:29:14 EDT
Thanks. I'll try that. I though there is something that will render again just this one command. I was about to use renderCommands in #callback, but I thought it is wrong ;)
Comment 6 Szymon Brandys CLA 2012-05-11 06:56:13 EDT
(In reply to comment #5)
> Thanks. I'll try that. I though there is something that will render again just
> this one command. I was about to use renderCommands in #callback, but I thought
> it is wrong ;)

Yup, it works.