The Link with editor support works with the ILinkHelper interface. See https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/ILinkHelper.java or http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fnavigator%2FILinkHelper.html The findSelection method is called only when the user activate an editor by clicking on the corresponding tab. The activateEditor method is called when the user clic on an element in a CommonViewer with active Link with editor support. The feature we want looks like the outline behavior: in a diagram editor powered by Sirius, the outline can display the overview of the diagram or a tree which shows semantic element displayed on the diagram regarding the diagram structure (and not the model structure). The selection synchronization between editor and outline is bi-directional. So we want to extends the behavior of the link with editor: . The new behavior must be active only when the link with editor is active . It has to handle the cases not supported by the ILinkHelper and must not react to the basic/standard ILinkHelper cases . When the focus is set to a new editor: let the link with editor works. . When changing the selection in the active editor . selection of the editor (diagram background) -> selection of the diagram/tree/table node in the model browser (placed under the semantic element which holds the representation) . selection of an element in the representation -> selection of the corresponding semantic element in the model browser . we have to pay attention to selections loops: when the selection in the model explorer comes from the synchronization from editor selection, the link with editor must not react ! Initial ideas: . " When the user uses the "link with Editor" button and select a shape, the semantic model should expand itself and focus on the selected object." The choice was made to synchronize the selection between an opened dialect editor and the model explorer. . The actual behavior is consistent for the view to editor direction. . The editor to view behavior should be : . when selecting the editor -> selection of the diagram in the model browser (placed under the semantic element which holds the diagram) . when selecting an element in the representation -> selection of the model element in the model browser New Gerrit change created: https://git.eclipse.org/r/52492 New Gerrit change created: https://git.eclipse.org/r/52614 New Gerrit change created: https://git.eclipse.org/r/52805 New Gerrit change created: https://git.eclipse.org/r/53246 Gerrit change https://git.eclipse.org/r/53246 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8e2f39d01c8dc08b4c986a795a969c739e370951 Gerrit change https://git.eclipse.org/r/52805 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=b072e3d4be8077b2934fd74ee1fb0932d4501b88 Gerrit change https://git.eclipse.org/r/52614 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=bf04a73d6efa05ddc069c6e518b3331f69dda132 Gerrit change https://git.eclipse.org/r/52492 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=d9bfff3b9751c874ef604a6013b18d0478c055d7 All corresponding commits have been pushed. Here is a bug: * Open a session with 2 representations * Activate the "link with editor" in the Model Explorer view * Open the first representation * Select something in the representation --> OK: the corresponding element is selected in the Model Explorer view. * Click on the second representation in the Model Explorer view --> KO: The first representation is automatically selected Here is another bug: . Open new RecurDiag from Bug 472036 . Select aaaa . Select az : both the region and the region container are selected: user has to reclick the element he really wanted to select. New Gerrit change created: https://git.eclipse.org/r/53856 The same issue will occurs for diagrams with relative edge mappings whose semantic element is the semantic element of the source. Gerrit change https://git.eclipse.org/r/53856 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=c53b0f75fcca110f7f0e1e54d0e4eff446c8153d New Gerrit change created: https://git.eclipse.org/r/53883 Gerrit change https://git.eclipse.org/r/53883 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=99d08188a34dd5269fca743074d293938195d3e2 Gerrit change https://git.eclipse.org/r/54319 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3e5fe2d5f3a1cba05c084490c9f43a4c62dbec15 When the user click on an element in the model explorer which can't be selected graphically (for example the type of a EAttribute, or the inheritance between two EClasses) the graphical selection is not updated. With this case the selection in the model browser and in the diagram doesn't match. This can be confusing. When selecting this kind of element in the Model Browser, the current selected elements in the diagram should be deselected. Gerrit change https://git.eclipse.org/r/54864 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=5f9a6586707fa1a349c9494bb7da9628652007a0 New Gerrit change created: https://git.eclipse.org/r/55064 Gerrit change https://git.eclipse.org/r/55064 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=7762524a2c12eeb95d7a8c34df474bfb3793a2e0 validated Validated on Sirius 3.1.0-S20151008-082237 Available in Sirius 3.1.0. |
The main idea of this bugzilla is to make the link with editor bi-directional in Sirius: when a DRepresentationElement/DRepresentation is selected in a Sirius editor (Diagram, Tree or Table), if the link editor is active, the corresponding semantic element should be selected in the model explorer view. The semantic element is the DSemanticDecorator.getTarget() result. Current behavior: . Selection of an element in the explorer: . semantic element -> selection of the corresponding element in the active representation (if existent). . representation node -> set focus to the corresponding editor . Selection of an element in a representation -> no selection change in explorer . Set focus on the editor -> focus and selection of the representation node in the explorer If the semantic element is not visible in the model explorer, we should expand the tree to make it visible. If the model element is expanded but not visible, we should scroll to make it visible (this should already be handled by the CNF). Additional question: When the user select an element in the model explorer view and if there is no selection target in the active no selection, should we have the same behavior than JDT : try to find another opened dialect editor which know the selection, activate it and then set the selection ? Note: the link with editor support is implemented in org.eclipse.sirius.ui.tools.internal.views.common.navigator.SessionLinkHelper Note: it seems that when the user selects a semantic element in the model explorer, the the corresponding DDiagramElement (for example) is selected, but when the user sets the focus on the editor, the propertyies view still displays the previous selection of the editor. The problem might needs to have its own bugzilla (choice will be made during analysis of this ticket or during implementation).