| Summary: | [Refactoring] The access to the ServiceRegistry should not depend on the active Papyrus Editor | ||
|---|---|---|---|
| Product: | [Modeling] Papyrus | Reporter: | Camille Letavernier <cletavernier> |
| Component: | Core | Assignee: | Cedric Dumoulin <cedric.dumoulin> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | cedric.dumoulin, cletavernier, Patrick.Tessier |
| Version: | unspecified | ||
| Target Milestone: | 0.9.0 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | 370129 | ||
| Bug Blocks: | 359057 | ||
|
Description
Camille Letavernier
We may investigate on the "Context"s in Eclipse e4 for solving this problem. This seems to be a good way of solving this kind of problems : http://www.eclipse.org/e4/resources/e4-whitepaper.php (Programming Model) http://www.vogella.de/articles/EclipseE4/article.html#programmingmodel http://www.eclipse.org/e4/resources/contexts.pdf Note that from inside papyrus code, you should NEVER access the ServiceRegistry by using the notion of current editor. You are allowed to access the ServiceRegistry by looking for the current editor only in the case of a user interaction, i.e. from inside a command handlers. Please see comments from the following classes that provide methods to get the ServiceRegistry in different cases: - org.eclipse.papyrus.core.utils.ServiceUtilsForActionHandlers - org.eclipse.papyrus.core.utils.ServiceUtils - org.eclipse.papyrus.diagram.common.util.ServiceUtilsForGMF The access to the ServicesRegistry do not depends on the active editor. It has never depend on the active Editor. If you already have the ServicesRegistry, you can access it even if the currently selected editor is not Papyrus. However, if you want to find the ServicesRegistry, you need a kind of context from which you can search for it. - If you are in an ui handler, this certainly mean that you want the ServicesRegistry of the currently selected Editor. This can be done with the org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers. This utility class DEPENDS ON the active editor. - If you are in a nested editor, you should have a way to get the ServiceRegistry from this editor. Wiki pages explain how to get the ServiceRegistry from different contexts (http://wiki.eclipse.org/Papyrus_Developer_Guide/How_To_Code_Examples#How_to_get_the_ServiceRegistry) Many different ServiceUtils* implementations are available now, which depend on a specific context element (e.g. EObject) instead of relying on the Active editor. I close this task |