Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Linking multiple files together
Linking multiple files together [message #32253] Tue, 29 August 2006 02:01 Go to next message
Eclipse UserFriend
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 #32532 is a reply to message #32253] Tue, 29 August 2006 04:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: senthil.periasamy.flextronicssoftware.com

Hi Ganesh
I am also doing the same thing what you are trying to do
... representing the vxml tags in the editor and prolonged discussion we
come to the conculsion that it is better not to manipulated with the 2
files created by the editor if you want to have your own file then it is
should offline process once your editor saves it then you read the file
through your code and convert it to your own format using XSLT or just
read the required data and create your own xml file, by the way it would
be helpful if you can share the schema file or ecore which you have
created for the VXML editor and by the way you are working for which
organisation and which place your working..

Regards
Senthil
Re: Linking multiple files together [message #32671 is a reply to message #32532] Tue, 29 August 2006 07:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ganesh.mohan.hp.com

Hi Senthil,

Thanx for ur suggestion.I will look into it.The problem i am facing is
even though i create a tag in a new file, i have to represent that tag as
an element on my editor for which the "diagram_file" has to have the
proper link information. I was wondering how to provide this. If i save
all the contents in the existing editor , the default files will be
updated which i dont want to happen.

I am working for Hewlett Packard in Bangalore.

Regards,
Ganesh
Re: Linking multiple files together [message #33987 is a reply to message #32253] Wed, 30 August 2006 07:50 Go to previous message
Eclipse UserFriend
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
Previous Topic:To seperate out the code for the new diagram file creation and the GMF part
Next Topic:Links between Connections
Goto Forum:
  


Current Time: Wed Apr 16 10:37:50 EDT 2025

Powered by FUDForum. Page generated in 0.05839 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top