Community
Participate
Working Groups
DDiagramEditorImpl isntalls an IChangeListener on its model in hookGraphicalViewer(): changeListener = ChangeListenerFactory.INSTANCE.getNewChangeListener(); semantic.eAdapters().add(changeListener); This is a rather costly mechanism (it installs an EMF ContentAdapter on the whole representation), and it is only used by SelectionCommandAppender to detect and auto-select newly-created edit parts after the execution of a tool. It could probably be replaced by a single post-commit listener to detect newly created DDiagramElements. The part about identifying the corresponding EditParts must happen later, so the post-commit listener should probably store the information about newly created elements, and SelectionCommandAppender should get its list from there instead of from TriggerOperation.run()'s first argument.
It would be nice if the "auto-select newly created elements" behavior could be generalized to all dialects (incl. tables and trees). This should be possible using DialectUIServices.setSelection(DialectEditor, List<DRepresentationElement>).
As proposed by Pierre-Charles, we could: - remove the DDiagramEditorImpl.changeListener - create a post commit listener to detect the creation of new DRepresentationElements, get their parent representation, and call DialectUIServices.setSelection(DialectEditor, List<DRepresentationElement>) ont the corresponding dialect editor. We have several solutions: one post commit listener per opened dialect editor or better I think: one common listener for each session (only one analysis is done for each transaction). The documentation about how to replace the IChangeListener mecanism will not be created in this bugzilla but during the correction of Bug 427872 Notes: - org.eclipse.sirius.ui.business.api.dialect.DialectEditor.getRepresentation() allow to get the representation of a DialectEditor - org.eclipse.sirius.ui.business.api.session.IEditingSession.getEditors() allows to get the opened editors of a session. - The post-commit listener could be created org.eclipse.sirius.ui.business.internal.session.EditingSession.initListeners()
org.eclipse.sirius.tools.api.ui.IExternalJavaAction2 should at least be deprecated.
See . https://git.eclipse.org/r/30592 : remove calls to SelectionCommandAppender (diagram only) . https://git.eclipse.org/r/30593 : creates a post commit listener, which, if the active editor is a DialectEdito, detects its newly created DRepresentationElements, and set the selection in with an ayncExec. The editpart refresh is done by a post commit listener installed by the editor after the agnostic "selector", hence it is triggered after. It calls the refresh of edit parts in a sync exec call, so the selection async runnable is called after.
Correct on master by commits b0a17fac77b3864456f7826782b07132886f5683 and 09f1d33be1450eaf456ec5f57eadd6dd74eab2b8
See previous comment. The post commit listener add in this bug now selects newly created DRepresentationElements in the current active dialect editor.
The dialect agnostic post commit listener causes performance issues with Tree representations (see Bug 442515). I reopen this issue as it introduced the SelectCreatedDRepresentationElementsListener mechanism. I will propose a new patch set to remove the dialect agnostic aspect and make it diagram specific back (the previous SelectionAppender mechanism and its IChangeListener was present only for Diagram representations). The central and unified selection behavior will be treated in a further issue (See bug 428545 for example). And Bug 442515 might be closed (as duplicate ? of the current issue) when the next patch will be accepted and the performance issue corrected.
Corrected by commit c5d0071dbffdb6f2bfdc6586d173532d83adb883. See https://git.eclipse.org/r/#/c/32407/ for the corresponding review. The auto-selection of created elements is only done on DDiagramEditors (as with the previous mechanism with the IChangeListener) but with a post commit listener. The mechanism has not been activated on Tree and Table due to observed performance issues (bug 442515).
Available in Sirius 2.0.0.