JanKoehnlein / FXDiagram

JavaFX diagram
Apache License 2.0
74 stars 21 forks source link

Cannot add xtext elements to diagram that are not exported in an IResourceDescription #46

Closed ralfellner closed 8 years ago

ralfellner commented 8 years ago

I'm using version 0.25.0-SNAPSHOT of FXDiagram with Eclipse and Xtext. I have create a own diagram configuration for our DSL. When adding some references to new elements via the side buttons of an existing node the selection animation hangs. The problem is an unhandled but swallowed NoSuchElementException in the rendering thread.

I have debugged the problem and found the following issues:

Due to the size of our model only very few objects are exported in an IResourceDescription. Some Element types do have a QualifiedName (calculated by DefaultDeclarativeQualifiedNameProvider) but are not exported in an IResourceDescription, in particular, the element type that is represented by an edge on a diagram.

When trying to add some of those edges to new nodes via the side buttons of an existing node the following happens: In XtextEObjectID.Factory a DefaultXtextEObjectID is created if a QN exists. Later, when the element shall be resolved, resolve(ResourceSet) in DefaultXtextEObjectID fails with a NoSuchElementException because the object is not exported via the IResourceDescription. This NoSuchElementException is not logged and essentially crashes the animation that displays the available nodes for the edge type.

JanKoehnlein commented 8 years ago

Added a fix in 0.26.0. Could you verify this solves your problem?

ralfellner commented 8 years ago

Yes, that fixes the problem. Thank you.