Initializing the diagram file [message #186236] |
Mon, 12 May 2008 06:21 |
Eclipse User |
|
|
|
Originally posted by: zzhangh.cn.ibm.com
Hi,
When initialized a diagram file from model file, the generated
".xxx_diagram" only contains the root diagram itself like following:
<xml>
<diagram>
</diagram>
Is there a way to generate a complete diagram file having all diagram
elements in it, as following:
<xml>
<diagram>
<node1/>
<node2/>
</diagram>
Regards,
Hao
|
|
|
|
|
Re: Initializing the diagram file [message #186562 is a reply to message #186313] |
Tue, 13 May 2008 09:14 |
Eclipse User |
|
|
|
Originally posted by: zzhangh.cn.ibm.com
Hi Alex,
Thanks for letting me know this method. The reason why I asked this
question is that in my application which uses GMF diagram partitioning,
when I initialized a diagram and opened it, if it contains a sub-diagram
and I double-clicked to open the sub-diagram and save it, the
"HintedDiagramLinkStyle" style of the sub-diagram node (actually the
node it self) is not persisted, so the next time I open the same
sub-diagram, a new diagram is generated in the notation model and it is
an unexpected duplicated diagram.
I think it is a bug because my diagram is very simple and I can easily
reproduce this issue (I'm using GMF2.1.0M6a, also tried on previous GMF
versions). I tried the method you provided in XXXInitDiagramFileAction
and XXXNewDiagramFileWizard, unfortunately till now I can't get the
sub-diagram node persisted, I'm going to invest more time on that.
It would be great if you can point out where I should modify on
generated codes or some glues on that.
Regards,
Hao
Alex Shatalin 写道:
> Hello Alex,
>
> Sorry.. If you are talking about diagram content initialization using
> existing model file then you should call Diagram.persistChildren()
> before saving the diagram from the editor to get all the elements saved.
> BTW, it's not necessary beause those elements wich was not modified by
> user will be automatically recreated on next DiagramEditor openning/
>
> -----------------
> Alex Shatalin
>
>
|
|
|
|
Re: Initializing the diagram file [message #187073 is a reply to message #186593] |
Thu, 15 May 2008 06:00 |
Eclipse User |
|
|
|
Originally posted by: zzhangh.cn.ibm.com
Hi Alex,
Your codes worked, till now I havn't found the issue any more. It is
great, thanks!
I submitted an bug entry for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=232229
BTW, several months ago I had another bug entry about diagram
partitioning (which is also an issue in the project we're developing),
do you happen to have any thouhgts on it?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214569
Regards,
Hao
Alex Shatalin 写道:
> Hello Hao,
>
>> I think it is a bug because my diagram is very simple and I can easily
> Looks like.. Let's continue trying to solve this problem by modifying
> the generated code and then submit a request describing existing
> solution for it.
>
>> XXXInitDiagramFileAction and XXXNewDiagramFileWizard, unfortunately
>> till now I can't get the sub-diagram node persisted, I'm going to
>> invest more time on that.
> Actually, taking into account your use case you have to modify generated
> OpenDiagramEditPolicy.OpenDiagramCommand.intializeNewDiagram () method. I
> suggest you to put following code in the very beggining of this method:
>
> EObject container = diagramFacet.eContainer();
> while (container instanceof View) {
> ((View) container).persist();
> container = container.eContainer();
> }
>
> Now node associated with the diagram you are going to open will be
> persisted together with whole containers.
>
> -----------------
> Alex Shatalin
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03503 seconds