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

Bug 489190

Summary: ClassCastException in org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper getGraphicalEditPart(View) method
Product: [Modeling] Sirius Reporter: Adam Lengyel <lengyela89>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/69321
Whiteboard:

Description Adam Lengyel CLA 2016-03-08 03:52:00 EST
- plugin: org.eclipse.sirius.diagram.ui (3.1.2.201511030845)
- package: org.eclipse.sirius.diagram.ui.internal.refresh
- class: GMFHelper
- method: getGraphicalEditPart(View)


In this method please check this part (line 646-648):

if (dialectEditor instanceof DiagramEditor && ((DiagramEditor) editor).getDiagram() != diagram) {
  diagramEditor = (DiagramEditor) dialectEditor;
}


Maybe instead of editor, you should use dialectEditor and instead of != you should use ==, like below:

if (dialectEditor instanceof DiagramEditor && ((DiagramEditor) dialectEditor).getDiagram() == diagram) {
  diagramEditor = (DiagramEditor) dialectEditor;
}

I ran into a situation, where editor contained a non DiagramEditor instance, and in that case the line 646 led to a ClassCastException.
Comment 1 Pierre-Charles David CLA 2016-03-08 05:15:17 EST
Hi, thanks for the feedback.

This looks like the issue which was already reported in bug #485426, but we did not have any reproduction scenario. Do you know how you got in a situation where "editor contained a non DiagramEditor instance", in terms of end-user actions? That would help reproduce and confirm a fix.

I'm closing this one as duplicate of the other, but that's only because #485426 was reported before.

*** This bug has been marked as a duplicate of bug 485426 ***
Comment 2 Eclipse Genie CLA 2016-03-25 10:06:51 EDT
New Gerrit change created: https://git.eclipse.org/r/69321