| [news.eclipse.modeling.gmf] Re: How to use the model created with one editor as a 'template' to createmodels |
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(templateFilePath);
IFile newFile = getNewModelFile();
try {
newFile.setContents(templateFile.getContents(), 1, progressMonitor);
} catch (CoreException e1) {
e1.printStackTrace();
}
}
......................... ........................ }
Thanks Biju
Hi Biju,
Anyone can tell me what I have to do?
Thanks Marsha