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,
I haven't tried this workaround yet, but wanted to point out another problem I ran across in trying to fix the JUnit tests. I have checked in a few changes, including one to keep persistentObjectAt(int) from ever returning null. I hit a problem if I start eclipse with one entity already defined and opened in the Persistence perspective:

@Entity
public class Employee {
   private int id;
}

Select the id attribute in the source code and change the mapping type to OneToMany through the Persistence Properties. In the error log I get this exception and also more exceptions when i close eclipse:

Caused by: java.lang.NullPointerException
at org.eclipse.dali.ui.selection.internal.dispatcher.SelectionDispatcher.getCurrentSelection(SelectionDispatcher.java:123) at org.eclipse.dali.ui.binding.EMFSWTBinding.<init>(EMFSWTBinding.java:44) at org.eclipse.dali.ui.composites.OrderByComposite.<init>(OrderByComposite.java:52) at org.eclipse.dali.ui.views.MultiRelationshipMappingComposite.buildGeneralTab(MultiRelationshipMappingComposite.java:120) at org.eclipse.dali.ui.views.MultiRelationshipMappingComposite.initializeLayout(MultiRelationshipMappingComposite.java:56) at org.eclipse.dali.ui.views.MultiRelationshipMappingComposite.<init>(MultiRelationshipMappingComposite.java:45) at org.eclipse.dali.ui.views.MultiRelationshipMappingComposite$MultiRelationshipMappingCompositeBuilder.buildMappingComposite(MultiRelationshipMappingComposite.java:238) at org.eclipse.dali.ui.views.MappingComposite.populate(MappingComposite.java:239) at org.eclipse.dali.ui.views.MappingComposite.access$1(MappingComposite.java:214) at org.eclipse.dali.ui.views.MappingComposite$5.run(MappingComposite.java:279)
   at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

Any ideas?

Karen

Hi,

there is clearly a bug in SelectionDispatcher. It shouldn't crash with a npe if the event history doesn't contain a selection for a given eclass. I fixed this in the cvs repo. From now on, as stated in the javadoc already, it returns null is such cases.
But your particular usecase will still fail regardless of my current fix.
I'm not even sure how we want to handle this. An OneToMany annotation is an invalid annotation for an int field. Obviously our EMF meta model doesn't contain a corresponding OrderBy object the binding could be an adapter for. My generalized proposition would be to remove invalid mappings (choices) from any combo (ui component). That way we shouldn't encounter such problems in the first place. :)

--
Regards,
Markus Kuppe

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



Back to the top