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

Bug 354877

Summary: DiagramDocumentEditor marks editor as being dirty when opened
Product: [Modeling] GMF-Runtime Reporter: Remy Suen <remy.suen>
Component: GeneralAssignee: Project Inbox <gmf-runtime-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: major    
Priority: P3 CC: contact, mariot.chauvin
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Remy Suen CLA 2011-08-16 14:23:52 EDT
If I open a .ecorediag file, the editor comes up as being dirty. I don't understand what the point of this is.

The offending code is in line 1485 of DiagramDocumentEditor's initializeTitle(*) method where a PROP_DIRTY event is fired.
Comment 1 Remy Suen CLA 2011-08-16 14:45:02 EDT
If I have a .ecorediag file in one lonely project then the problem does not occur. I get the problem if I open our Eclipse 4 model in our project though.
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.model.workbench?h=R4_development
Comment 2 Remy Suen CLA 2011-08-16 15:03:48 EDT
This is a trace from 4.x. I see the same problem on 3.x though.

Thread [main] (Suspended (breakpoint at line 125 in WorkbenchPart))	
	EcoreDiagramEditor(WorkbenchPart).firePropertyChange(int) line: 125	
	EcoreDiagramEditor(GraphicalEditor).firePropertyChange(int) line: 201	
	EcoreDiagramEditor(DiagramDocumentEditor).firePropertyChange(int) line: 1032	
	DiagramDocumentEditor$ElementStateListener$2.run() line: 1282	
	DiagramDocumentEditor$ElementStateListener.execute(Runnable, boolean) line: 1458	
	DiagramDocumentEditor$ElementStateListener.elementDirtyStateChanged(Object, boolean) line: 1285	
	EcoreDocumentProvider(AbstractDocumentProvider).fireElementDirtyStateChanged(Object, boolean) line: 668	
	EcoreDocumentProvider.access$0(EcoreDocumentProvider, Object, boolean) line: 1	
	EcoreDocumentProvider$ResourceSetModificationListener.notifyChanged(Notification) line: 947	
	GMFResource(BasicNotifierImpl).eNotify(Notification) line: 380	
	GMFResource(ResourceImpl).setModified(boolean) line: 1802	
	GMFResource$1(ResourceImpl$ModificationTrackingAdapter).notifyChanged(Notification) line: 1691	
	GMFResource$1.notifyChanged(Notification) line: 150	
	NodeImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	EObjectContainmentEList<E>(EcoreEList<E>).dispatchNotification(Notification) line: 255	
	EObjectContainmentEList<E>(NotifyingListImpl<E>).remove(int) line: 719	
	EObjectContainmentEList<E>(AbstractEList<E>).remove(Object) line: 466	
	EcoreUtil.remove(EObject) line: 3096	
	DestroyElementCommand.doExecuteWithResult(IProgressMonitor, IAdaptable) line: 127	
	DestroyElementCommand(AbstractTransactionalCommand).doExecute(IProgressMonitor, IAdaptable) line: 247	
	DestroyElementCommand(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 150	
	DestroyElementCommand.destroy(EObject) line: 94	
	ViewUtil.destroy(View) line: 182	
	ViewUtil.destroy(View) line: 180	
	DeleteCommand.doExecuteWithResult(IProgressMonitor, IAdaptable) line: 71	
	DeleteCommand(AbstractTransactionalCommand).doExecute(IProgressMonitor, IAdaptable) line: 247	
	DeleteCommand(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 150	
	ICommandProxy.execute() line: 68	
	CompoundCommand.execute() line: 111	
	CanonicalEditPolicy$1.doExecute(IProgressMonitor, IAdaptable) line: 486	
	CanonicalEditPolicy$1(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 150	
	EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).executeCommand(Command) line: 492	
	EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).deleteViews(Iterator<View>) line: 371	
	EPackageContentsCanonicalEditPolicy.deleteOrphanedViews() line: 120	
	EPackageContentsCanonicalEditPolicy.refreshSemantic() line: 97	
	EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).refresh() line: 961	
	EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).refreshOnActivate() line: 638	
	EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).activate() line: 628	
	EPackageContentsEditPart(AbstractEditPart).activateEditPolicies() line: 174	
	EPackageContentsEditPart(AbstractEditPart).activate() line: 156	
	EPackageContentsEditPart(AbstractGraphicalEditPart).activate() line: 195	
	GraphicalEditPart.access$0(GraphicalEditPart) line: 1	
	EPackageContentsEditPart(GraphicalEditPart).activate() line: 205	
	EPackage2EditPart(AbstractEditPart).activate() line: 160	
	EPackage2EditPart(AbstractGraphicalEditPart).activate() line: 195	
	GraphicalEditPart.access$0(GraphicalEditPart) line: 1	
	EPackage2EditPart(GraphicalEditPart).activate() line: 205	
	EPackageCanonicalEditPolicy(CanonicalConnectionEditPolicy).refreshOnActivate() line: 105	
	EPackageCanonicalEditPolicy(CanonicalEditPolicy).activate() line: 628	
	EPackageEditPart(AbstractEditPart).activateEditPolicies() line: 174	
	EPackageEditPart(AbstractEditPart).activate() line: 156	
	EPackageEditPart(AbstractGraphicalEditPart).activate() line: 195	
	GraphicalEditPart.access$0(GraphicalEditPart) line: 1	
	EPackageEditPart(GraphicalEditPart).activate() line: 205	
	EPackageEditPart(DiagramEditPart).activate() line: 349	
	RenderedDiagramRootEditPart(AbstractEditPart).addChild(EditPart, int) line: 215	
	RenderedDiagramRootEditPart(SimpleRootEditPart).setContents(EditPart) line: 105	
	DiagramGraphicalViewer(AbstractEditPartViewer).setContents(EditPart) line: 617	
	DiagramGraphicalViewer.setContents(EditPart) line: 352	
	DiagramGraphicalViewer(AbstractEditPartViewer).setContents(Object) line: 626	
	EcoreDiagramEditor(DiagramEditor).initializeGraphicalViewerContents() line: 872	
	EcoreDiagramEditor.initializeGraphicalViewerContents() line: 459	
	EcoreDiagramEditor(DiagramEditor).initializeGraphicalViewer() line: 865	
	EcoreDiagramEditor(DiagramEditorWithFlyOutPalette).initializeGraphicalViewer() line: 116	
	EcoreDiagramEditor(DiagramDocumentEditor).initializeGraphicalViewer() line: 174	
	EcoreDiagramEditor.initializeGraphicalViewer() line: 343	
	EcoreDiagramEditor(DiagramEditor).createGraphicalViewer(Composite) line: 807	
	EcoreDiagramEditor(GraphicalEditor).createPartControl(Composite) line: 171	
	EcoreDiagramEditor(DiagramEditor).createPartControl(Composite) line: 1580	
	EcoreDiagramEditor(DiagramEditorWithFlyOutPalette).createPartControl(Composite) line: 328	
	EcoreDiagramEditor(DiagramDocumentEditor).createPartControl(Composite) line: 1510	
	CompatibilityEditor(CompatibilityPart).createPartControl(IWorkbenchPart, Composite) line: 122
Comment 3 Mariot Chauvin CLA 2011-08-17 03:59:47 EDT
According to the stack trace the behavior seems correct. At the opening the editor launches a refresh and detects that there is a desynchronization between the semantic model and the graphical one, so it updates the graphical model.

If you save your file after the opening, and compare textually with the one before saving you will see a diff.    


(In reply to comment #2)
> This is a trace from 4.x. I see the same problem on 3.x though.
> 
> Thread [main] (Suspended (breakpoint at line 125 in WorkbenchPart))    
>     EcoreDiagramEditor(WorkbenchPart).firePropertyChange(int) line: 125    
>     EcoreDiagramEditor(GraphicalEditor).firePropertyChange(int) line: 201    
>     EcoreDiagramEditor(DiagramDocumentEditor).firePropertyChange(int) line:
> 1032    
>     DiagramDocumentEditor$ElementStateListener$2.run() line: 1282    
>     DiagramDocumentEditor$ElementStateListener.execute(Runnable, boolean) line:
> 1458    
>     DiagramDocumentEditor$ElementStateListener.elementDirtyStateChanged(Object,
> boolean) line: 1285    
>    
> EcoreDocumentProvider(AbstractDocumentProvider).fireElementDirtyStateChanged(Object,
> boolean) line: 668    
>     EcoreDocumentProvider.access$0(EcoreDocumentProvider, Object, boolean)
> line: 1    
>    
> EcoreDocumentProvider$ResourceSetModificationListener.notifyChanged(Notification)
> line: 947    
>     GMFResource(BasicNotifierImpl).eNotify(Notification) line: 380    
>     GMFResource(ResourceImpl).setModified(boolean) line: 1802    
>    
> GMFResource$1(ResourceImpl$ModificationTrackingAdapter).notifyChanged(Notification)
> line: 1691    
>     GMFResource$1.notifyChanged(Notification) line: 150    
>     NodeImpl(BasicNotifierImpl).eNotify(Notification) line: 380    
>    
> EObjectContainmentEList<E>(EcoreEList<E>).dispatchNotification(Notification)
> line: 255    
>     EObjectContainmentEList<E>(NotifyingListImpl<E>).remove(int) line: 719    
>     EObjectContainmentEList<E>(AbstractEList<E>).remove(Object) line: 466    
>     EcoreUtil.remove(EObject) line: 3096    
>     DestroyElementCommand.doExecuteWithResult(IProgressMonitor, IAdaptable)
> line: 127    
>    
> DestroyElementCommand(AbstractTransactionalCommand).doExecute(IProgressMonitor,
> IAdaptable) line: 247    
>     DestroyElementCommand(AbstractEMFOperation).execute(IProgressMonitor,
> IAdaptable) line: 150    
>     DestroyElementCommand.destroy(EObject) line: 94    
>     ViewUtil.destroy(View) line: 182    
>     ViewUtil.destroy(View) line: 180    
>     DeleteCommand.doExecuteWithResult(IProgressMonitor, IAdaptable) line: 71    
>     DeleteCommand(AbstractTransactionalCommand).doExecute(IProgressMonitor,
> IAdaptable) line: 247    
>     DeleteCommand(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable)
> line: 150    
>     ICommandProxy.execute() line: 68    
>     CompoundCommand.execute() line: 111    
>     CanonicalEditPolicy$1.doExecute(IProgressMonitor, IAdaptable) line: 486    
>     CanonicalEditPolicy$1(AbstractEMFOperation).execute(IProgressMonitor,
> IAdaptable) line: 150    
>    
> EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).executeCommand(Command)
> line: 492    
>    
> EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).deleteViews(Iterator<View>)
> line: 371    
>     EPackageContentsCanonicalEditPolicy.deleteOrphanedViews() line: 120    
>     EPackageContentsCanonicalEditPolicy.refreshSemantic() line: 97    
>     EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).refresh() line:
> 961    
>    
> EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).refreshOnActivate()
> line: 638    
>     EPackageContentsCanonicalEditPolicy(CanonicalEditPolicy).activate() line:
> 628    
>     EPackageContentsEditPart(AbstractEditPart).activateEditPolicies() line: 174 
>     EPackageContentsEditPart(AbstractEditPart).activate() line: 156    
>     EPackageContentsEditPart(AbstractGraphicalEditPart).activate() line: 195    
>     GraphicalEditPart.access$0(GraphicalEditPart) line: 1    
>     EPackageContentsEditPart(GraphicalEditPart).activate() line: 205    
>     EPackage2EditPart(AbstractEditPart).activate() line: 160    
>     EPackage2EditPart(AbstractGraphicalEditPart).activate() line: 195    
>     GraphicalEditPart.access$0(GraphicalEditPart) line: 1    
>     EPackage2EditPart(GraphicalEditPart).activate() line: 205    
>    
> EPackageCanonicalEditPolicy(CanonicalConnectionEditPolicy).refreshOnActivate()
> line: 105    
>     EPackageCanonicalEditPolicy(CanonicalEditPolicy).activate() line: 628    
>     EPackageEditPart(AbstractEditPart).activateEditPolicies() line: 174    
>     EPackageEditPart(AbstractEditPart).activate() line: 156    
>     EPackageEditPart(AbstractGraphicalEditPart).activate() line: 195    
>     GraphicalEditPart.access$0(GraphicalEditPart) line: 1    
>     EPackageEditPart(GraphicalEditPart).activate() line: 205    
>     EPackageEditPart(DiagramEditPart).activate() line: 349    
>     RenderedDiagramRootEditPart(AbstractEditPart).addChild(EditPart, int) line:
> 215    
>     RenderedDiagramRootEditPart(SimpleRootEditPart).setContents(EditPart) line:
> 105    
>     DiagramGraphicalViewer(AbstractEditPartViewer).setContents(EditPart) line:
> 617    
>     DiagramGraphicalViewer.setContents(EditPart) line: 352    
>     DiagramGraphicalViewer(AbstractEditPartViewer).setContents(Object) line:
> 626    
>     EcoreDiagramEditor(DiagramEditor).initializeGraphicalViewerContents() line:
> 872    
>     EcoreDiagramEditor.initializeGraphicalViewerContents() line: 459    
>     EcoreDiagramEditor(DiagramEditor).initializeGraphicalViewer() line: 865    
>    
> EcoreDiagramEditor(DiagramEditorWithFlyOutPalette).initializeGraphicalViewer()
> line: 116    
>     EcoreDiagramEditor(DiagramDocumentEditor).initializeGraphicalViewer() line:
> 174    
>     EcoreDiagramEditor.initializeGraphicalViewer() line: 343    
>     EcoreDiagramEditor(DiagramEditor).createGraphicalViewer(Composite) line:
> 807    
>     EcoreDiagramEditor(GraphicalEditor).createPartControl(Composite) line: 171  
>     EcoreDiagramEditor(DiagramEditor).createPartControl(Composite) line: 1580   
>    
> EcoreDiagramEditor(DiagramEditorWithFlyOutPalette).createPartControl(Composite)
> line: 328    
>     EcoreDiagramEditor(DiagramDocumentEditor).createPartControl(Composite)
> line: 1510    
>     CompatibilityEditor(CompatibilityPart).createPartControl(IWorkbenchPart,
> Composite) line: 122