[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [gmf-dev] Creating copy of an existing diagram and model file
|
Hello!
It's better to ask such kind of questions in a newsgroup. Fortunately
there was a similar question recently:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/msg13810.html
THT
-------------
Alex Shatalin
-----Original Message-----
From: gmf-dev-bounces@xxxxxxxxxxx [mailto:gmf-dev-bounces@xxxxxxxxxxx]
On Behalf Of Alexander.Nachtigall@xxxxxxxxx
Sent: Wednesday, July 09, 2008 2:55 PM
To: gmf-dev@xxxxxxxxxxx
Subject: [gmf-dev] Creating copy of an existing diagram and model file
Dear gmf community,
please help me solving a little problem.
I try to open a pre-defined GMF-Diagram and to save this as a copy of it
to another diagram file.
My application under development is RCP-based.
*The unsolved problem*: the xyz.model_diagram contains "href"s to the
xyz.model file. And the copy of xyz still contains hrefs to the
original, template diagram.
Questions:
How do i reorganize all cross references within my gmf resource files
???
How is the model data copied from diagram X to diagram Y when copying
the content of X.model_diagram to Y.model_diagram?
Thx for any help!
Alex
------------------------------------------------------------------------
-----------------------------------------------
Here the code snippet:
final Diagram diagramCopy = (Diagram)
EcoreUtil.copy(activeEditor.getDiagram());
final EObject modelCopy = EcoreUtil.copy()
ArrayList<IFile> affectedFiles = new ArrayList<IFile>();
AbstractTransactionalCommand copyCommand = new
AbstractTransactionalCommand(editingDomain, "CopyContent",
affectedFiles) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info)throws ExecutionException {
diagramCopy.setName(diagramUri.lastSegment());
/* copy the content from the template to new editingDomain */
newDiagramResource.getContents().add(diagramCopy);
/* seems the model data is not copied from the diagram */
/*PseudoCode*/
openDiagram(newDiagramResource);
// results in graphical copy of template but has reference to original
template model. New model is empty.
_______________________________________________
gmf-dev mailing list
gmf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gmf-dev