[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: How to use the model created with one editor as a 'template' to createmodels

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(templateFilePath);
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