Community
Participate
Working Groups
1. select a n element in the diagram --> the property sheet page is updated 2. select another element in the diagram --> the property view is not updated. The property sheet page has now post listener, before it was only a listener. But the event for the post listener during the selection of diagram is not send. So I have added a small patch, the is only a tempory patch in order to refresh the property view.
Created attachment 190517 [details] tempory patch This not a solution only to allow developer working with the property view
the property view is refresh by a post listener: In a normal case: the DiagramGraphicalViewer has postListener given by the PageSelectionService. But in the case of papyrus the mutlieditpageSite cannot add a postlistener to the DiagramGraphicalViewer because the DiagramGraphicalViewer do not Implement IPostSelectionProvider. if(selectionProvider != null) { selectionProvider.addSelectionChangedListener(getSelectionChangedListener()); if(selectionProvider instanceof IPostSelectionProvider) { ((IPostSelectionProvider)selectionProvider).addPostSelectionChangedListener(getPostSelectionChangedListener()); } } So I will study why and How, in the case of a simple editor, the PageSelectionListener add a postListener to the graphicalViewer
Code that comes from WindowSelectionService (line287): if (newPart != null) { activeProvider = selectionProvider; // Fire an event if there's an active provider activeProvider.addSelectionChangedListener(selListener); ISelection sel = activeProvider.getSelection(); fireSelection(newPart, sel); if (activeProvider instanceof IPostSelectionProvider) { ((IPostSelectionProvider) activeProvider) .addPostSelectionChangedListener(postSelListener); } else { activeProvider.addSelectionChangedListener(postSelListener); } firePostSelection(newPart, sel); Here we see the PsotListener is always added as a PostListenr or normal listerner. I will propose a patch to apply the same machanism.
Created attachment 190531 [details] Patch that a postlistener on a DiagramGraphcialViewer I'm waiting for your opinion before committing
More details about the problem: - We have 3 main entities: - The PropertyView, listening on selectionChangedEvents from Papyrus - The DiagramGraphicalViewer, implementing ISelectionProvider, and throwing selectionChangedEvents - Papyrus, contains multiple DiagramGraphicalViewer. It also provide a main selectionProvider implementing ISelectionChanged and IPostSelectionChanged (by the way of its site and MultiPageSelectionProvider) - The PropertyView ask to Papyrus its selectionProvider and listen on selection changed events. As MultiPageSelectionProvider implements both ISelectionChanged and IPostSelectionChanged, the PropertyView only listen on postSelectionChangedEvent. - Each DiagramGraphicalViewer is registered to the nested editor site as a selectionChanged provider. The DiagramGraphicalViewer only send selectionChangedEvent (and not postSelectionChangedEvents) - Papyrus (by the way of MultiPageEditorSite and MultiPageSelectionProvider) relay any selection changed events from nested editors to listeners registered to Papyrus main selectionProvider. So, a DiagramGraphicalViewer send a selectionChangedEvent, which is relayed by Papyrus but the PropertyView only listen postSelectionChangedEvent. So it never see the event :-(. The patch propose to send a second event of type postSelectionChangedEvent if the nested editor doesn't implements IPostSelectionChanged. This is implemented in org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageEditorSite.
patch apply in the branch done in the revision 4337
Patch applied in the head (revision 4338)