Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to use the model created with one editor as a 'template' to create models.
How to use the model created with one editor as a 'template' to create models. [message #148790] Mon, 03 September 2007 06:04 Go to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi friends,

What I am trying to do is to create a diagram using editor1,
save it, then use it as a 'template' to create models in editor2. That
is I need to use the model created with editor1 as a 'template' to
create models in editor2. I am using both the editors in a single rcp
application. I have generated two separate gmf models and digram
plugins(for each editors), but both sharing the same ecore model.

Can you please tell me, how to load the editor2 with the model
created with editor1.

Thanks and Regards Biju
Re: How to use the model created with one editor as a 'template' to createmodels. [message #149923 is a reply to message #148790] Tue, 11 September 2007 05:08 Go to previous messageGo to next message
Eclipse UserFriend
Hello biju,

In non-RCP version of the generated diagramming plugin you have "Initialize
.... diagram file" popup menu action for the domain model file. AFAIU you
should do something similar to initialize a diagram for editor2. You can
use this action as an example.

-----------------
Alex Shatalin
Re: How to use the model created with one editor as a 'template' to createmodels. [message #150385 is a reply to message #149923] Wed, 12 September 2007 07:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi Alex,

Thanks for your reply,

I have done it, by copying the contents of selected model file
to the new model file.

But I have a problem in layout. The layout in my template
figure is not maintained in the newly created model digram. Where is
such data about layout saved for a digram file.? Any Ideas.!

Thanks again Biju

Alex Shatalin wrote:
> Hello biju,
>
> In non-RCP version of the generated diagramming plugin you have
> "Initialize ... diagram file" popup menu action for the domain model
> file. AFAIU you should do something similar to initialize a diagram for
> editor2. You can use this action as an example.
>
> -----------------
> Alex Shatalin
>
>
>
Re: How to use the model created with one editor as a 'template' to createmodels [message #150400 is a reply to message #150385] Wed, 12 September 2007 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marsha.rohrer.swisscom.com

Hi Biju,

biju wrote:
> Where is such data about layout saved for a digram file.? Any Ideas.!

If you open the diagram file with a text editor you can see the layout in
XML manner. But I can't tell you how to get it in a programatically...

Greets

Marsha
Re: How to use the model created with one editor as a 'template'to createmodels. [message #150547 is a reply to message #150385] Thu, 13 September 2007 04:24 Go to previous messageGo to next message
Eclipse UserFriend
Hello biju,

You can load diagram file and get instance of org.eclipse.gmf.runtime.notation.Diagram
from there. Diagram element size/positions are available through this API.

-----------------
Alex Shatalin
Re: How to use the model created with one editor as a 'template' to createmodels [message #150678 is a reply to message #150385] Thu, 13 September 2007 08:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marsha.rohrer.swisscom.com

Hi Biju, Alex,

Sorry but I don't get it and I think I have the same goal as Biju.

I have a model with an extension .model then I have two editors with
different extensions .a_diagram and .b_diagram.

If I use "Inizialize .b_diagram file" I'd like that the diagram with the
a_diagram extension is loaded as template for .b_diagram. Thats what you
did Biju isn't it?

If yes could you please explain in more detail how you did it?

Thanks for your help

Marsha
Re: How to use the model created with one editor as a 'template' to createmodels [message #152175 is a reply to message #150385] Wed, 26 September 2007 02:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marsha.rohrer.swisscom.com

biju wrote:

> I have done it, by copying the contents of selected model file
> to the new model file.

> But I have a problem in layout. The layout in my template
> figure is not maintained in the newly created model digram. Where is
> such data about layout saved for a digram file.? Any Ideas.!

Hi

Could anyone describe me how this copying of content works exactelly? And
how the problem with the layout can be solved?

I think I have to work with DiagramEditorInput, is that right?

Thanks

Marsha
Re: How to use the model created with one editor as a 'template' to createmodels [message #152294 is a reply to message #152175] Thu, 27 September 2007 00:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi Marsha,

Sorry for the late reply,

What I have done to copy the content of one file to another
is as follows:

In my second digram file creation wizard, I have added a wizard
page to choose the template file. And on performFinish() of the wizard I
copy the content of the selected template file in to my newly created
xmi file, of the new digram.

(ButThe layout is not maintained as I am not copying the content of
digram file, and copying the content of digram file is not possible as
it contains some unique id's for each digram plugin.)

The sample code is as follows,

public boolean performFinish() {
.........................
........................

IPath templateFilePath=new Path(tempPath);
IFile templateFile =
ResourcesPlugin.getWorkspace().getRoot().getFile(templateFil ePath);
IFile newFile = getNewModelFile();

try {
newFile.setContents(templateFile.getContents(), 1, progressMonitor);
} catch (CoreException e1) {
e1.printStackTrace();
}
}

.........................
........................
}



Thanks Biju



Marsha wrote:
> biju wrote:
>
>> I have done it, by copying the contents of selected model
>> file to the new model file.
>
>> But I have a problem in layout. The layout in my template
>> figure is not maintained in the newly created model digram. Where is
>> such data about layout saved for a digram file.? Any Ideas.!
>
> Hi
>
> Could anyone describe me how this copying of content works exactelly?
> And how the problem with the layout can be solved?
>
> I think I have to work with DiagramEditorInput, is that right?
>
> Thanks
>
> Marsha
>
>
Re: How to use the model created with one editor as a 'template' to createmodels [message #152312 is a reply to message #152294] Thu, 27 September 2007 02:40 Go to previous message
Eclipse UserFriend
Originally posted by: marsha.rohrer.swisscom.com

biju wrote:

> Hi Marsha,

> Sorry for the late reply,

> What I have done to copy the content of one file to another
> is as follows:

> In my second digram file creation wizard, I have added a wizard
> page to choose the template file. And on performFinish() of the wizard I
> copy the content of the selected template file in to my newly created
> xmi file, of the new digram.

> (ButThe layout is not maintained as I am not copying the content of
> digram file, and copying the content of digram file is not possible as
> it contains some unique id's for each digram plugin.)

> The sample code is as follows,

> public boolean performFinish() {
> .........................
> ........................

> IPath templateFilePath=new Path(tempPath);
> IFile templateFile =
> ResourcesPlugin.getWorkspace().getRoot().getFile(templateFil ePath);
> IFile newFile = getNewModelFile();

> try {
> newFile.setContents(templateFile.getContents(), 1, progressMonitor);
> } catch (CoreException e1) {
> e1.printStackTrace();
> }
> }

> .........................
> ........................
> }



> Thanks Biju

Hi Biju,

Thanks for your replay...the idea with the creation wizard is good, but
I'd prefer to use the "Initialize editor2_diagram file" menu item.

Anyone can tell me what I have to do?

Thanks
Marsha
Previous Topic:How to get editpart using its Impl
Next Topic:Problem in saving java.util.List in model.
Goto Forum:
  


Current Time: Fri Jul 18 00:30:05 EDT 2025

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

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

Back to the top