How to use the model created with one editor as a 'template' to create models. [message #148790] |
Mon, 03 September 2007 06:04  |
Eclipse User |
|
|
|
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 #152294 is a reply to message #152175] |
Thu, 27 September 2007 00:38   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06026 seconds