Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339384 - [client] command visibility vs. enablement
Summary: [client] command visibility vs. enablement
Status: RESOLVED WONTFIX
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-09 11:12 EST by Susan McCourt CLA
Modified: 2012-06-08 17:30 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2011-03-09 11:12:36 EST
we support visibleWhen in the command framework, but currently don't have a mechanism for enable/disable once a command is visible.  I recall that the commands in e4 dropped having two different expressions in favor of something different (injection? ???).  
Talk to Paul W. about this after M6.
Comment 1 Paul Webster CLA 2011-03-09 11:24:16 EST
in e4 we have:

Commands, abstract semantic representation
Contributions (actual tool or menu items) that can have a visibleWhen applied
Handler that can have an enabledWhen applied

The wiring is different than 3.x in that enabled is not a state of either the command or handler, but a question that can be asked in a specific context (the window, the specific part, etc).

The modeled workbench/renderers in 4.x can still do enabledWhen test first and then call @CanExecute.

PW
Comment 2 Susan McCourt CLA 2011-04-27 17:16:25 EDT
I'm trying to find cases in the current code where having enabled logic would really help usability.  (I know that we need this from a framework completion point of view, just finding the most important use cases).

So far the place I miss enable/disable the most is git merge. 
When I fetch and I have incoming changes, I know I need a merge, because it shows me the changes.  But if I fetch and there aren't incoming changes, the merge button is still enabled, and sometimes I push it to figure out what it does, and then remember, "oh yeah, there's nothing to merge."

I'm just not sure how the framework would know when to rerun the enabled logic in this case.  The command is on a toolbar and its state would change when we ran the fetch command.
Comment 3 Susan McCourt CLA 2011-04-27 17:30:14 EDT
likewise for push.  When I'm looking at local commits and i'm up to date with remote, it would be nice for push to be disabled.

I assume the enablement state for push can be calculated easily (since its established at page load time), and that a simple enabledWhen expression would work here.
Comment 4 Susan McCourt CLA 2011-05-31 20:27:55 EDT
This is a fairly pervasive change so I'm not attempting it for first release.  Note that the plugins provide validation criteria and we could later decide to apply this criteria to enabledWhen vs. visibleWhen without changing plug-in "API"
Comment 5 Susan McCourt CLA 2011-09-23 15:35:25 EDT
If anyone has examples (screenshots) of web UI's that show disabled commands, I'd like to see them.  Trying to understand if enabled makes sense in a web UI that is much more stateless.  Are most of the enabled states so complex that we would not bother trying to maintain them?
Comment 6 Susan McCourt CLA 2012-06-08 17:30:34 EDT
I'm closing this because I don't see us doing it.  As I've observed various web apps, the actions just tend to appear/disappear as selections change, etc.  The cases in this bug that were more interesting are really cases where hiding/showing the commands would work as well as enable/disable.  The trick for some of them is deciding when to check validity.