I've done some more research on this:
I think about two possible solutions (sure there are more and you might see more obvious ones):
(1) In E3.x we have the ToggleState and RadioState elements which are located in org.eclipse.jface; I say Eclipse 3.x as they transitively depend on org.eclipse.core.commands.State which extends StateManager taking care to persist the selection.
What about porting ToggleState (for CHECK) and RadioState (for RADIO) to the Eclipse 4 model and introduce for every [Tool | Menu]Item of type CHECK or RADIO a state field, as has been done in Eclipse 3.x. Possibly this state element could also leverage the persisted state map as described by Paul. Because, in the solution Tom described every synchronization connection between application model#MMenuItem.isSelected() <-> global variable#filter-male-setting would have to be hand-coded for each item. This is a big step backward from what has been available so far.
(2) Provide some kind of @Initialize or possible use an already available @Annotation for [Tool | Menu]Item of type CHECK or RADIO where the given class Uri is simply called once on initialization injected with the current element, allowing me to synchronize their states.
I would clearly prefer (2) as it easily fills the missing link for me and is more e4 style.
Currently the whole RADIO, CHECK thing is of limited usage I think. Or what is the use case for menu elements of this type not being easily synchronizable with the states in my application? Or is there an easy way to hook to "ID".isSelected(), resp. RadioGroup.setSelected(Element e)?
cheers, marco
On Sat, Dec 29, 2012 at 12:55 PM, Marco Descher <marco@xxxxxxxxxx> wrote:
Would it make sense to couple the state of a CHECK or RADIO item with a "Persisted State" entry?
Or wouldn't it be a good thing to introduce some advanced methodology for CHECK or RADIO buttons to ease synchronization?
While I'm not sure that this is the way to go, there is a persisted state map (string to string) that can be used to store important state in the model.
PW
-- Paul Webster Hi floor. Make me a sammich! - GIR
_______________________________________________ e4-dev mailing list e4-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/e4-dev
|