Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 283978

Summary: ClassCastException at org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory.doBuildGraph(GraphModelEntityFactory.java:87)
Product: [Tools] GEF Reporter: Philippe Coucaud <phil_fj12>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: irbull
Version: 3.5   
Target Milestone: 3.6.0 (Helios) RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philippe Coucaud CLA 2009-07-20 03:21:35 EDT
Build ID: I20090611-1540

1. instantiate a GraphViewer, set a content provider of type IGraphContentProvider, set proper label provider and input element (calling setInput() is required).
2. change the content provider to be of a different type than IGraphContentProvider (e.g. IGraphEntityContentProvider)
3. set a new input (calling setInput() is required): a ClassCastException exception occurs in GraphModelEntityFactory.doBuildGraph():

java.lang.ClassCastException: [...] cannot be cast to org.eclipse.zest.core.viewers.IGraphEntityContentProvider
at org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory.doBuildGraph(GraphModelEntityFactory.java:87)
at org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory.createGraphModel(GraphModelEntityFactory.java:45)
at org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer.inputChanged(AbstractStructuredGraphViewer.java:482)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:274)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634)
[...]

Because the factory created by GraphViewer.getFactory() is cached in 'modelFactory', only one type of content provider is allowed once the GraphViewer's input is set. The cache should probably be flushed when the type of the content provider changes.
Comment 1 Ian Bull CLA 2010-03-15 01:23:01 EDT
I started to fix this, but I want to do some more testing. I will release a fix in M7.
Comment 2 Anthony Hunter CLA 2010-05-03 13:10:25 EDT
We released 3.6 M7 today so moving unresolved bugs to 3.6 RC1.

We need to re-access if we can complete these for Helios.
Comment 3 Ian Bull CLA 2010-05-17 01:36:43 EDT

*** This bug has been marked as a duplicate of bug 267557 ***