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

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

Markus Kuppe wrote:

Karen Moore wrote:
Markus,
I'm trying to implement an EMFBindingAction for
MultiRelationshipMapping.mappedBy.  The problem I hit is when the
EMFSWTBinding is created it calls
ISelectionDispatcher.getCurrentSelection(EClass).  The selection it is
looking for is a OneToManyMapping, but the EClass is a
MultiRelationshipMapping which is a superType of OneToManyMapping. Any ideas on how we should handle this case?

thanks,
Karen

Hi,

try this:

### Eclipse Workspace Patch 1.0
#P org.eclipse.dali.ui.selection
Index:
source/org/eclipse/dali/ui/selection/internal/notification/SelectionNotification.java
===================================================================
RCS file:
/cvsroot/technology/org.eclipse.dali/plugins/org.eclipse.dali.ui.selection/source/org/eclipse/dali/ui/selection/internal/notification/SelectionNotification.java,v
retrieving revision 1.3
diff -u -r1.3 SelectionNotification.java
---
source/org/eclipse/dali/ui/selection/internal/notification/SelectionNotification.java
26 Mar 2006 19:04:11 -0000	1.3
+++
source/org/eclipse/dali/ui/selection/internal/notification/SelectionNotification.java
29 Mar 2006 18:50:20 -0000
@@ -97,7 +97,7 @@
		} else {
			for(Iterator itr = getIndirectSelections().iterator(); itr.hasNext();) {
				EObject eObj = (EObject) itr.next();
-				if(eObj.eClass().equals(anEClass)) {
+				if(eObj.eClass().equals(anEClass) ||
anEClass.isSuperTypeOf(eObj.eClass())) {
					return eObj;
				}
			}

But consider this more as a quick hack. Its not really tested and it
might break something else. For the moment it feels right though. If
this isn't working, I will look into it tomorrow.



Back to the top