| Summary: | [Property view] selection in the diagram is not taken in account in the property view | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Papyrus | Reporter: | Patrick Tessier <Patrick.Tessier> | ||||||
| Component: | Core | Assignee: | Patrick Tessier <Patrick.Tessier> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Yann Tanguy <yann.tanguy> | ||||||
| Severity: | blocker | ||||||||
| Priority: | P3 | CC: | cedric.dumoulin, Patrick.Tessier | ||||||
| Version: | 0.8.0 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Patrick Tessier
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) |