Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] EMF binding/selection committed

Karen Moore wrote:
Hi Markus,

After further investigation, I don't think I understand how the ISelectionDispatcher is supposed to work. Tak the use case I gave earlier

@Entity
public class Employee {
 private Collection<Address> address;
}

and make address a one-to-many through the Persistence Properties view. In this situation, the selection occured when I selected the address attribute in the java editor. At this point the address mapping was an InvalidMapping, so the SelectionDispatcher stored that information. When I selected One to Many as the mapping type through the Persistence Properties view, the MultiRelationshipComposite is built and along with it the OrderByComposite. The OrderByComposite creates the EMFSWTBinding and in that constructor the call to dispatcher.getCurrentSelection is made. The SelectionDispatcher only has information about the selection when the attribute was an InvalidMapping, not in its current state as a OneToManyMapping, because a new selection did not occur. How is this expected to work?


Hi,

the ISelectionDispatcher hence the selection project isn't supposed to handle this use case at all. Its only purpose is to wrap low level widget (UI) selections into EMF EObject selections and send these selections to the registered listeners (ISelectionListeners).

The EMF binding on the other hand utilizes ISelectionDispatcher to get the current "active/selected" EMF EObject in the UI. It doesn't care for selection events and is therefor not an ISelectionListener.


In regards to the given use case I see two different solutions. The first one would be, to add another constructor to EMFSWTBinding that takes a real EMF EObject and not just the EClass. This way you don't need to "query" the ISelectionDispatcher because you already have the correct EObject. In my opinion an even better solution is to make the part which creates the new EMF EObject of the Properties View an ISelectionTracker. Basically it changes the current selection, so it should notify the ISelectionDispatcher. That way we don't need to change the EMFSWTBinding as it still can use the ISelectionDispatcher to get hold of the current EObject.

--
Regards,
Markus Kuppe

Versant GmbH, European Headquarters
Wiesenkamp 22b, 22359 Hamburg, Germany
+49(40)60990-215, http://www.versant.com



Back to the top