|How to link business model (file) to diagram instance? [message #1708690]
||Fri, 18 September 2015 18:52
| Rafal Filipiuk
Registered: September 2015
So I have my plugin project and when I launch the editor and create a new diagram (of my type), the latter is not pointing to any particular business model. Some of the features themselves (such as create()) will instantiate the eObject, and only when the user saves the diagram will the eObject get serialized into File.foo. I'm not entirely sure how it works in the background, but when a create() is called (via user creating the box representing the eObject) and the eObject is instantiated, the editingDomain of the diagram holds a LazyLinkingResource pointing to File.foo. From then on, the diagram's editingDomain will point to File.foo.|
Currently, File.foo is statically initialized in a java file, so it's relatively easy to point to the resource, update it, and save it within a transaction. The problem is that, because File.foo is static, every new diagram will point to it. What I want to do is have the editingDomain point to X.foo when the diagram is created, while somehow initializing a non-static instance of X.foo. The file should just be called diagramName.foo.
How would I go about doing that? When a user creates a new diagram of myType using the plugin, where can I create X.foo? I'm just not sure of who should take ownership of the resource. My thought was for the Diagram itself to create X.foo and an instance of the object to be modified/serialized, but I don't know where to begin.
Note that I have no experience with GEF/EMF, so everything is kind of hacked together and my knowledge of the domain is quite cursory. Any doc, protips, would help.
P.S. I apologize if any of the above is difficult to understand. I will elaborate as much as I can.
Powered by FUDForum
. Page generated in 0.02252 seconds