Linking multiple files together [message #32253] |
Tue, 29 August 2006 02:01  |
Eclipse User |
|
|
|
Originally posted by: ganesh.mohan.hp.com
Consider the situation below:
Doc1:
-----
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<menu id="M_1">
<prompt> say choice one to test the choice element </prompt>
<choice next="#doc2.F1" fetchtimeout="10s" maxstale="500">
choice one
</choice>
</menu>
Doc2:
-----
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<form id="F1">
<block>
<prompt> test successful </prompt>
</block>
</form>
</vxml>
From the above example it is apparent that the Menu dialog in Doc1 has a
link to the Form Dialog in doc2. To implement this situation in GMF we
came across some problems.
In the run-time we get two files one is the temp.gvxml file and the other
is the temp_diagram.gvxml file where the temp_diagram.xml holds the
notational aspects of the diagram. Now suppose we draw many objects on the
editor where each represents a particular "tag" in the vxml file. When we
save it, the editor input now will have all the resouceset and will save
it to a single "temp.gvxml" file and temp_diagram.gvxml file.
If we consider the above situation where we want some tags in the editor
to be saved in a different file say "temp2.gvxml" , i am able to create
this file , but the problem is not able to save any information from the
editor separately into this file and update the contents of the
diagram_file.
Investigation: During the save operation ,the Editing domain holds the
resource set that is currently available from the editor - iput.Even if we
implement our own save operation by overriding the classes, the default
save operation will ensure that it saves all the contents from the
editor-input into the default files "temp.gvxml" and "temp_diagram.gvxml"
which is a undesired and incorrect behaviour for the editor i am
developing.I am not sure whether GMF architecture supports the creation of
multiple files and providing links to these files using a single
"diagram_file".Can you please help us on this issue.
Thanx,
Ganesh
|
|
|
|
|
Re: Linking multiple files together [message #33987 is a reply to message #32253] |
Wed, 30 August 2006 07:50  |
Eclipse User |
|
|
|
Hello Ganesh,
> Investigation: During the save operation ,the Editing domain holds the
> resource set that is currently available from the editor - iput.Even
> if we implement our own save operation by overriding the classes, the
> default save operation will ensure that it saves all the contents from
> the editor-input into the default files "temp.gvxml" and
> "temp_diagram.gvxml" which is a undesired and incorrect behaviour for
You can add “@generated NOT” java-doc comment to the corresponding method
in generated code and change it in accordance with your saving logic, but
I do not think this is ideal solution.
> the editor i am developing.I am not sure whether GMF architecture
> supports the creation of multiple files and providing links to these
> files using a single "diagram_file".Can you please help us on this
> issue.
EMF provides you with the possibility to cross-link objects stored in different
files. It looks like the usecase you are talking about. GMF is based on EMF,
so it uses all EMF features (including cross-resource references) so, looks
like you can make use of it. Moreover, I remember Ed Merks recently wrote
that it is possible to use “cross resource containment” in EMF ( http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg00202.html)
so you can make use of this feature as well to fulfill your requirements.
AFAIU, you should store semantic model element for each top-level diagram
node in a separate file. (please, correct me if you are working with different
use-case) Standard code generated by GMF works with two resources. One is
diagram resource storing notation model instances (representation of the
diagram node) with references to the semantic (domain) model elements. Another
resource is domain model storage. All these resources are grouped into the
single ResourceSet associated with open diagram. Once you press “save” in
editor, all the resources opened in this editor (present in corresponding
ResourceSet) will be saved. To store semantic object associated with top-level
diagram node in a separate resource you should do the following while creating
domain model instance:
- create new resource
- load it into resource set associated with diagram
- create new EMF object (domain model object)
- put this object into the created resource
as a result, on pressing “save” newly created resource will be found in the
diagram ResourceSet and corresponding model object will be saved into this
resource.
If this is what you need you can try changing ???ItemSemanticEditPolicy
generated for your diagram element. This EditPolicy returns Command responsible
for creation corresponding semantic model element from it’s getCreateCommand(CreateElementRequest
req) method (you can check it by debugging). I suggest you to change corresponding
Create???Command inner-class in this EditPolicy. Looks like you have to override
doDefaultElementCreation() method inherited from CreateElementCommand and
put new domain model element + resource creation code there.
In addition you can face some problems with deleting corresponding diagram
element + reopening the diagram (m.b. something else) but I think you have
the point to start and it looks like using EMF API and my suggestions nothing
should stop you from storing some diagram elements in a separate files.
Do not hesitate to ask additional questions or correct me if I misunderstood
your requirements.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.05839 seconds