Dynamic command handlers for diagram-selections [message #1804784] |
Mon, 01 April 2019 08:54 |
Felix Dorner Messages: 392 Registered: December 2015 |
Senior Member |
|
|
Hi,
I think this is a common issue, so not sure if Sirius has already a solution:
I have an org.eclipse.core.command that's enabled on a given domain element type. I want to be able to execute the command also when a diagram element that maps to that type is selected.
The current way is that handlers are just coupled to sirius:
1. their enablement must work for diagram elements with the corredt target type
2. the handler code itself must first translate the diagram selection to the domain selection
Whenever I face this, I hate it, and wonder if there's a better way, and maybe someone tried already? Maybe this could work:
If I have a list of command ids, I could dynamically register a handler for these commands that
1. is active, by checking if another handler for that command is active while replacing the selection of diagram elements with the selection of domain elements.
2. executes that other handler, again, replacing the selection
Yes, I would need to know the commands that should be treated that way, e.g. via extension, but still better than having to deal with 2 kinds of selections all the time no?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03761 seconds