| Summary: | [diagram] Improve diagram layout storage story | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Konstantin Komissarchik <konstantin> |
| Component: | Sapphire | Assignee: | Shenxue Zhou <shenxue.zhou> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | gregory.amerson, ram.venkataswamy |
| Version: | unspecified | Keywords: | usability |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Konstantin Komissarchik
Also I noticed that if you don't have a diagrams folder already created, it will fail when you try to load an editor with a diagram part with this exception: !ENTRY org.eclipse.sapphire.ui 4 0 2011-04-21 15:23:07.130 !MESSAGE Resource '/taglib-test-portlet/.settings/diagrams' does not exist. !STACK 1 org.eclipse.core.internal.resources.ResourceException: Resource '/taglib-test-portlet/.settings/diagrams' does not exist. at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:326) at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:200) at org.eclipse.core.internal.resources.File.create(File.java:123) at org.eclipse.core.internal.resources.File.create(File.java:196) at org.eclipse.sapphire.ui.swt.graphiti.editor.SapphireDiagramEditorFactory.createEditorInput(SapphireDiagramEditorFactory.java:71) at com.liferay.ide.eclipse.servicebuilder.ui.ServiceBuilderEditor.createDiagramPages(ServiceBuilderEditor.java:36) at org.eclipse.sapphire.ui.SapphireEditor.addPages(SapphireEditor.java:368) at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138) at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670) Even though the diagrams folder exists on the disk drive, it doesn't show up in eclipse, it hasn't been "refreshed". If you manually refresh the .settings folder, diagrams will show up and then the editor will load correctly. For the resource exception, I added code to refresh the diagram settings folder and files when opening diagrams. Please let me know if this helps. > For the resource exception, I added code to refresh the diagram settings folder
> and files when opening diagrams. Please let me know if this helps.
That is an incorrect fix. Opening an editor should never cause changes to resources (such as triggering a refresh). The proper fix is to make sure that layout file writing and creation of corresponding folders happens via Eclipse resource API.
The root cause here is the EMF based diagram xmi file used by Graphiti. We don't rely on it to restore diagram layout. I'll need to look into ways to removing it completely. While doing some testing on diagrams I noticed that if I have the same filename but in different folders in a project, the diagram for node location and connections is shared between both files. I found this by doing the following in some project: test-folder-aaa/service.xml test-folder-bbb/service.xml Then trying to save diagram layout changes in either of these files will wipeout the changes saved in the other. I guess the reason is because both service.xml files will share or resolve to the same diagrams file .settings/diagrams/service.xmi/np 1. There is now a setting in the diagram page def to allow side-by-side layout storage 2. Fixed ResourceException 3. Diagram files with same names but in different folders should not override each other's layout 4. The diagram layout file has ".layout" extension. When it's not stored side by side with the diagram xml file, it's under ".settings/org.eclipse.sapphire.ui.diagram/<project relative path of the diagram xml file>/<file>.layout 5. I'm not able to get rid of the graphiti diagram file. But the graphiti diagram file is always placed under the diretory under ".settings/org.eclipse.sapphire.ui.diagram/...". So it's not in user's way. See http://www.eclipse.org/forums/index.php/t/202467/ 6. The diagram layout file won't store node size if the node is not resizable. 7. For file name for layout and graphiti diagram now contains diagram page id Verified with build#367 verified with build 0.3.0.201106021201 > 5. I'm not able to get rid of the graphiti diagram file. But the graphiti > diagram file is always placed under the diretory under > ".settings/org.eclipse.sapphire.ui.diagram/...". So it's not in user's way. See > http://www.eclipse.org/forums/index.php/t/202467/ Placing any artifacts not absolutely required into user project is a big deal. If Graphiti absolutely needs a file, can you point it at some location in workspace or better yet, a temporary directory? If you absolutely cannot think of a way to fix this, add a node regarding this to the bug that tracks eliminating dependency on Graphiti. > 7. For file name for layout and graphiti diagram now contains diagram page id Not seeing this. At least not for the map sample. The file name is just "map.layout". Meant to re-open. (In reply to comment #9) > > 5. I'm not able to get rid of the graphiti diagram file. But the graphiti > > diagram file is always placed under the diretory under > > ".settings/org.eclipse.sapphire.ui.diagram/...". So it's not in user's way. See > > http://www.eclipse.org/forums/index.php/t/202467/ > > Placing any artifacts not absolutely required into user project is a big deal. > If Graphiti absolutely needs a file, can you point it at some location in > workspace or better yet, a temporary directory? If you absolutely cannot think > of a way to fix this, add a node regarding this to the bug that tracks > eliminating dependency on Graphiti. > > > 7. For file name for layout and graphiti diagram now contains diagram page id > > Not seeing this. At least not for the map sample. The file name is just > "map.layout". I've tried to use workspace temp dir to store the diagram file but by the time Graphiti/EMF got a hold of it, it'd throw ResourceException. (In reply to comment #9) > > 5. I'm not able to get rid of the graphiti diagram file. But the graphiti > > diagram file is always placed under the diretory under > > ".settings/org.eclipse.sapphire.ui.diagram/...". So it's not in user's way. See > > http://www.eclipse.org/forums/index.php/t/202467/ > > Placing any artifacts not absolutely required into user project is a big deal. > If Graphiti absolutely needs a file, can you point it at some location in > workspace or better yet, a temporary directory? If you absolutely cannot think > of a way to fix this, add a node regarding this to the bug that tracks > eliminating dependency on Graphiti. > > > 7. For file name for layout and graphiti diagram now contains diagram page id > > Not seeing this. At least not for the map sample. The file name is just > "map.layout". I added a new method in SapphireDiagramEditorFactory class so that individual editor can pass in a page id. If the editor doesn't pass it, it won't try to attach the page id to the layout file. I'll modify the map editor to pass that additional param. The sdef file has an id for the page definition. Please use that instead. I modified MapEditor class to pass in the diagram page id defined in page def when creating editor input. So the map sample uses "map_diagram" as the file name for the layout storage. Rather than changing the sample, this should be implemented such that explicit action from the developer is not necessary. The sdef always has page id. That id should be used. The new method on SapphireDiagramEditorFactory should not be necessary. I am going to close this as is. We are going to need to revisit the API for controlling persistence of diagram layout information in the future anyway. Some scenarios, for instance call for storing layout in the same file as the data and you have to follow their schema, etc. This is good enough for now. |