Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums"Diagram is not present" message when opening 2nd Editor
https://www.eclipse.org/forums/index.php/mv/msg/441264/989779/#msg_989779
http://wiki.eclipse.org/Diagram_Partitioning.
I have 1 editor for the model root and another for a node that gets opened on double click of the node.
The editors work well in isolation but I have an issue when I invoke the Open Behaviour on the node.
If I create a new diagram (root editor) then add two nodes and double click the first the node editor opens fine.
If I switch back to the root editor and double click the second node then I get the message "Cannot open input element. Reason: Diagram is not present in resource".
The message comes from my generated XXXDocumentProvider (Which has been modified to use a shared editing domain according to codeDOTgoogleDOTcom/p/gmftools/wiki/SharedEditingDomain).
When the first node editor is opened the DiagramImpl is in the GMFResource.
When the Second node editor is opened the DiagramImpl is NOT in the GMFResource.
If I save the root editor before opening the second node editor it open without error.
If I close the 1st node editor before opening the 2nd it will open without error. I would guess that this is because closing the 1st node editor triggers the save event that cleans up the model.
Any suggestions on what might be wrong or how best to investigate this further?]]>Jim Clark2012-12-07T17:29:57-00:00Re: "Diagram is not present" message when opening 2nd Editor
https://www.eclipse.org/forums/index.php/mv/msg/441264/990049/#msg_990049
Although it's a tricky area to debug this is what I've found:
Starting with the Root element editor open and a Node editor open.
Add additional node in the root editor and double click to open the Node editor.
This new node editor will share the same resource instance as the existing editors.
The open action triggers a save of the underlying resource.
This save will update the resource object (in a ResourceSyncJobs).
These are added to the workspace jobs and so wont run until after the OpenAction is complete.
OpenAction continues to open the new editor with a URI for the new node in the existing resource that hasn't yet been updated.
This causes the RuntimeException in the setDocumentContent method of the Node DocumentProvider.
This doesn't happen with the first open of the Node editor as the resource is loaded from the file (which has been saved) and doesn't need to be updated by the sync operation.
Now trying to workout how to schedual opening the editor after the sync jobs have completed.]]>Jim Clark2012-12-10T16:27:15-00:00Re: "Diagram is not present" message when opening 2nd Editor
https://www.eclipse.org/forums/index.php/mv/msg/441264/990206/#msg_990206
The problem was simply that my editingDomainIDs didn't match. Understandably fixing this fixes the issue.]]>Jim Clark2012-12-11T11:58:11-00:00