Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Management of the plugin.xml
Management of the plugin.xml [message #60621] Tue, 10 October 2006 08:52 Go to next message
Eclipse UserFriend
Hi,
I'd like to know how I can preserve my customizations in the plugin.xml file
when I generate again the diagram code. The plugin.xml is owerwritten every
time, and I lose all my extensions although not the related source code.
What should I do?

I've another problem: I'd like to generate diagram code from two gmfgen
files in the same project in order to share the same source package (each
generated diagram code has its own packages and sub-packages). Every time I
generate the diagram code (from the .gmfgenA or from the .gmfgenB) the
plugin.xml file is overwritten. How can I merge the two generated plugin.xml
files without modify them programmatically by hand?

Thanks in advance.

Best regards,
Fabio.
Re: Management of the plugin.xml [message #60631 is a reply to message #60621] Tue, 10 October 2006 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

Fabio Centineo wrote:
> Hi,
> I'd like to know how I can preserve my customizations in the plugin.xml file
> when I generate again the diagram code. The plugin.xml is owerwritten every
> time, and I lose all my extensions although not the related source code.
> What should I do?

http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy#R20

> I've another problem: I'd like to generate diagram code from two gmfgen
> files in the same project in order to share the same source package (each
> generated diagram code has its own packages and sub-packages). Every time I
> generate the diagram code (from the .gmfgenA or from the .gmfgenB) the
> plugin.xml file is overwritten. How can I merge the two generated plugin.xml
> files without modify them programmatically by hand?

The simplest solution would be to have two projects.
Re: Management of the plugin.xml [message #60645 is a reply to message #60631] Wed, 11 October 2006 04:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dmtry,
thank you so much for your reply. I would like to use the same project for
all editors because my aim is to use an unique editing doman for them.
I have already tryed to use an unique editing domain for one of my editors
(by using the hints provided by EMFT), end it works very well.
Now I would like to integrate this idea for all my editors and thus having a
unique model for all types of diagram.
It seems that the protected regions in
http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy#R20
could be used also for this. But the unique plugin.xml should be handled by
hand.

Have you any idea ?

Thanks again.

Best regards,
Fabio.

"Dmitry Stadnik" <5d5@mail.ru> ha scritto nel messaggio
news:eggemq$m4p$1@utils.eclipse.org...
> Fabio Centineo wrote:
>> Hi,
>> I'd like to know how I can preserve my customizations in the plugin.xml
>> file when I generate again the diagram code. The plugin.xml is
>> owerwritten every time, and I lose all my extensions although not the
>> related source code. What should I do?
>
> http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy#R20
>
>> I've another problem: I'd like to generate diagram code from two gmfgen
>> files in the same project in order to share the same source package (each
>> generated diagram code has its own packages and sub-packages). Every time
>> I generate the diagram code (from the .gmfgenA or from the .gmfgenB) the
>> plugin.xml file is overwritten. How can I merge the two generated
>> plugin.xml files without modify them programmatically by hand?
>
> The simplest solution would be to have two projects.
Re: Management of the plugin.xml [message #62098 is a reply to message #60645] Fri, 13 October 2006 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

> all editors because my aim is to use an unique editing doman for them.
There were a number of postings describing how you can use the same editing
domain in different diagramming plugins generated by GMF. I suggest you to
still use own plugin for each of the generated diagrams.

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #65595 is a reply to message #62098] Thu, 19 October 2006 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
thanks for your help and sorry for my late reply.
I have to ask you some question. What do you mean with "the same editing
domain in different diagramming plugins" ?
Does it mean that I can use the same editing domain between different
projects (everyone of which with the own plugin.xml) ?
Please, can you indicate me any post in which this is described ?

Thanks in advance,
Fabio.

"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3120c48c8bce660a81066@news.eclipse.org...
> Hello Fabio,
>
>> all editors because my aim is to use an unique editing doman for them.
> There were a number of postings describing how you can use the same
> editing domain in different diagramming plugins generated by GMF. I
> suggest you to still use own plugin for each of the generated diagrams.
>
> -----------------
> Alex Shatalin
>
>
Re: Management of the plugin.xml [message #65700 is a reply to message #65595] Thu, 19 October 2006 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

Yes, you are understanding me correctly. Try searching/reading the newsgroup
like: http://www.eclipse.org/search/search.cgi?q=shared+editing+do main+GMF&form=extended&wf=574a74&ps=10&m=all &t=5&ul=&wm=wrd&t=News&t=Mail

in particular - postings like: http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg00424.html

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #66165 is a reply to message #65700] Fri, 20 October 2006 05:45 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Alex,
now I will take a look to these post.
Only a question, very sample but very important for me: I open an editor
correctly, but I can't add any element into the diagram (this is a
consequence of my attempt to use the same editing domain between different
GMF projects).
In which part of the GMF generated code (or into the plugin.xml ) I can look
for this problem ?

Thanks again.

Best regards,
Fabio.



"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3122f68c8c1bc633d2e61@news.eclipse.org...
> Hello Fabio,
>
> Yes, you are understanding me correctly. Try searching/reading the
> newsgroup like:
> http://www.eclipse.org/search/search.cgi?q=shared+editing+do main+GMF&form=extended&wf=574a74&ps=10&m=all &t=5&ul=&wm=wrd&t=News&t=Mail
>
> in particular - postings like:
> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg00424.html
>
> -----------------
> Alex Shatalin
>
>
Re: Management of the plugin.xml [message #66265 is a reply to message #66165] Fri, 20 October 2006 07:22 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

Please check editingDomainID property of GenDiagram in both genmodels. This
property should handle the same id.

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #67482 is a reply to message #66265] Mon, 23 October 2006 04:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
thanks again for your help.
Unfortunately :-( my projects still not works with the same editing domain.
I followed the next steps:

1. in both files .gmfgen I inserted the same editingDomainID;
2. I genereted the source code for both the projects;
3. in the plugin.xml of one I have inserted the following extension point

<extension
point="org.eclipse.emf.transaction.editingDomains">
<editingDomain
factory="org.eclipse.emf.workspace.WorkspaceEditingDomainFactory "
id="PAML.CommonEditingDomain"/>
</extension>

and removed the createEditingDomain() method in both editor classes;
4. both methods getEditingDomainID() return the same ID;
5. I seen that in both plugin.xml there is a clientContext that refers to
the shared editingDomainID:

<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings ">
<clientContext id="PAML_PlanDiagramClientContext">
<enablement>
<test property="org.eclipse.gmf.runtime.emf.core.editingDomain"
value="PAML.CommonEditingDomain"/>
</enablement>
</clientContext>
........
6. If I launch both plugins with the eclipse run-time, in both diagram I
can't add any element.

The elements used in a diagram are a subset used into the other diagram.
Thus, I use the same eClass with the same editingDomain and with two
different ID (everyone for a diagram).
I also tryed to make sharing elements with the same ID in both the
projects, but the result is always the same: I can't add any element into
the diagrams.
What should I do? Am I making any error?

Sorry for the time you are spending for me and thanks again.

Best regards,
Fabio.


"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3123488c8c261e0a5871c@news.eclipse.org...
> Hello Fabio,
>
> Please check editingDomainID property of GenDiagram in both genmodels.
> This property should handle the same id.
>
> -----------------
> Alex Shatalin
>
>
Re: Management of the plugin.xml [message #67602 is a reply to message #67482] Mon, 23 October 2006 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

Did you substitute duplicating "metamodelType" with "specializationType"?
(I've suggested this to one of the corresponding postings).
Do you see any errors in the log?
You can debug element creation by putting breakpoints into the generated
???VisualIDRegistry.getNodeVisualID() method. VisualIDRegistry is responsible
for determining element type and will be called on each element creation.
Result should be > 0 for the known elements.

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #67881 is a reply to message #67602] Mon, 23 October 2006 10:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
I modified "metamodelType" with "specializationType" (maybe in an incorrect
way, please take a look at the attachments).
In the log file I don't see any error. The method
???VisualIDRegistry.getNodeVisualID() returns a >0 value only when I open
the diagram (for the diagram element); when I try to add an element into a
diagram, this method is never crossed ().
The very strange thing is that the diagram in whicht I declared the
extension point for the editing domain works only if I close the other
project.
If both plugins are loaded, the first one doesn't work any more.

I posted the two plugin.xml: plugin1.xml contains the extension point and
the "metamodelType",
whereas the second one contains "specializationType".
I'm sure that I forget and mistake something, but I don't understand what.

Thanks again and sorry for my insistence.

Best regards,
Fabio.



"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3123d48c8c4b3966acc5b@news.eclipse.org...
> Hello Fabio,
>
> Did you substitute duplicating "metamodelType" with "specializationType"?
> (I've suggested this to one of the corresponding postings).
> Do you see any errors in the log?
> You can debug element creation by putting breakpoints into the generated
> ???VisualIDRegistry.getNodeVisualID() method. VisualIDRegistry is
> responsible
> for determining element type and will be called on each element creation.
> Result should be > 0 for the known elements.
>
> -----------------
> Alex Shatalin
>
>



  • Attachment: plugin2.xml
    (Size: 15.16KB, Downloaded 267 times)
  • Attachment: plugin1.xml
    (Size: 29.38KB, Downloaded 164 times)
Re: Management of the plugin.xml [message #68033 is a reply to message #67881] Mon, 23 October 2006 12:38 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

> I modified "metamodelType" with "specializationType" (maybe in an
> incorrect way, please take a look at the attachments).
Looks like plugin.xml was correctly patched. Did you create corresponding
HelperAdvice classes?

> ???VisualIDRegistry.getNodeVisualID() returns a >0 value only when I
> open the diagram (for the diagram element); when I try to add an element
> into a diagram, this method is never crossed ().
Really strange. Can you put a breakpoint into both generated ???ViewProvider.getNodeViewClass
? This method should be called on creating command for creating an element
(once you pick a tool from the palette and move it upon the diagram).

> If both plugins are loaded, the first one doesn't work any more.
What about “second” siagram? Does it work? It looks like a conflict across
two plugins. Looks like you have to spend some time in debugging. BTW, do
you have DIFFERENT modelIDs specified in genmodels for these two plugins?

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #70030 is a reply to message #68033] Thu, 26 October 2006 06:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
sorry for my late reply but I made a lot of attempts and debug in order to
find my problem.
For simplicity, I used a sample (the shape example posted in the attachment)
which contains only Square, Circle and Connection.
I created two GMF projects (shape and simpleShape) everyone builded from own
..gmfgraph, .gmftool, .gmfmap and gmfgen files; both the editors shared the
same model (shape.uml -> shape.ecore and shape.genmodel).
Starting to these two projects, my aim is to make sharing the same editing
domain among them.
In order to achieve this, I made all the attempts that I told you during
this thread. But also with this simple example, I encountered the same
problems (in both kind of diagrams I can't add any element).
The solution I found has been that one to use the same ClientContextID in
both the plugin.xml for the
org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings extension point.
Both the clientContext already shared the same editingDomainID (setted in
both the gmfgen).
Is this the correct solution ? Is this what I forgotten to do (an unique
clientContex) ?
But also in this way, a problem happens:

1. I create DiagramA (a shape diagram)
2. I create DiagramB (a simpleShape diagram)
3. Both the diagrams work fine.
4. If I create another diagram (a shape diagram or a simpleShape diagram),
the old ones don't work any more. Two exceptions happens:

a) FileDocumentProvider.createElementInfo

org.eclipse.core.runtime.CoreException: Resource contains no diagram
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal .util.DiagramIOUtil.load(DiagramIOUtil.java:197)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal .util.DiagramIOUtil.load(DiagramIOUtil.java:123)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.docu ment.FileDiagramDocumentProvider.setDocumentContentFromStora ge(FileDiagramDocumentProvider.java:154)
...................................................

b) Unable to create editor ID shape.diagram.part.ShapeDiagramEditorID: An
exception was thrown during initialization

java.lang.NullPointerException
at
org.eclipse.emf.transaction.util.TransactionUtil.getEditingD omain(TransactionUtil.java:50)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .DiagramModificationListener. <init>(DiagramModificationListener.java:52)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.docu ment.FileDiagramModificationListener. <init>(FileDiagramModificationListener.java:53)
at
shape.diagram.part.ShapeDocumentProvider$CustomModificationL istener. <init>(ShapeDocumentProvider.java:151)
at
shape.diagram.part.ShapeDocumentProvider.createFileInfo(Shap eDocumentProvider.java:102)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.docu ment.FileDocumentProvider.createElementInfo(FileDocumentProv ider.java:486)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.connect(AbstractDocumentProvider.j ava:387)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.doSetInput(DiagramDocumentEditor.java:42 6)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.setInput(DiagramDocumentEditor.java:389)
at org.eclipse.gef.ui.parts.GraphicalEditor.init(GraphicalEdito r.java:318)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.init( DiagramEditor.java:643)
...................................................


In the attachment I posted the shape example (model source code, GMF files
for both plugins and the two GMF projects), please take a look.
If using the same clientcontext for both the editor is the right solution,
Do I need to make what is indicated in the thread
MultiPageEditor and ElementBinding (Dynamic editing domain ID) ?

Thanks again Alex and sorry for all the time you spend for me.

Best regards,
Fabio


"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3124068c8c4e986d0a94d@news.eclipse.org...
> Hello Fabio,
>
>> I modified "metamodelType" with "specializationType" (maybe in an
>> incorrect way, please take a look at the attachments).
> Looks like plugin.xml was correctly patched. Did you create corresponding
> HelperAdvice classes?
>
>> ???VisualIDRegistry.getNodeVisualID() returns a >0 value only when I
>> open the diagram (for the diagram element); when I try to add an element
>> into a diagram, this method is never crossed ().
> Really strange. Can you put a breakpoint into both generated
> ???ViewProvider.getNodeViewClass
> ? This method should be called on creating command for creating an element
> (once you pick a tool from the palette and move it upon the diagram).
>
>> If both plugins are loaded, the first one doesn't work any more.
> What about "second" siagram? Does it work? It looks like a conflict across
> two plugins. Looks like you have to spend some time in debugging. BTW, do
> you have DIFFERENT modelIDs specified in genmodels for these two plugins?
>
> -----------------
> Alex Shatalin
>
>


Re: Management of the plugin.xml [message #70194 is a reply to message #70030] Thu, 26 October 2006 09:51 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

Took a look on your sample projects – looks great! ;-) It works!

> 4. If I create another diagram (a shape diagram or a simpleShape
> diagram),
> the old ones don't work any more. Two exceptions happens:
Actually the problem is not in the creation of another diagram. Correct steps
to reproduce it are:
- Create one diagram and save it
- Close this diagram
- Create another diagram and save it
- Try to reopen first diagram
This problem was recently reported and fixed in 1.0.1 and 2.0 builds: https://bugs.eclipse.org/bugs/show_bug.cgi?id=153893

You can get rid of this problem by updating your GMF to the corresponding
versions and regenerating diagram code or by modifying following condition
in both ShapeDocumentProviders:

“nextResource != diagramResource” -> “nextResource != diagramResource &&
nextResource.isLoaded()”

Once you correct this problem you’ll face another one:
- Create new Diagram-1
- Create new Diagram-2
- Save both diagrams
- Close and delete diagram+model files for Diagram-1
- Modify and save Diagram-2 -> model file for Diagram-1 will be re-created
To get rid of this problem you have to override disposeElementInfo() method
in generated ShapeDocumentProvider. This method is responsible for unloading
resources on closing corresponding diagram editor. Currently only diagram
resource is unloaded there. You can modify this method to unload model file
in addition.

I’m going to create wiki page concerning step-by-step description of how
to modify generated code to use shared editing domain across several diagrams.
If you are interested – I can send you a link.

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #70272 is a reply to message #70194] Thu, 26 October 2006 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
thank you so much :-)). I didn't think I had to use the same clientContextID
for both diagrams.
If I would like to create a clientContext through code as described in
"MultiPageEditor and ElementBinding (Dynamic editing domain ID) ",
where could I create it ? Can I create it in the editor class ?

> I'm going to create wiki page concerning step-by-step description of how
> to modify generated code to use shared editing domain across several
> diagrams. If you are interested - I can send you a link.
I am very interested, thank you.

Thanks a lot for all your help :-).

Best regards,
Fabio.


"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3125a08c8c72dac61f66e@news.eclipse.org...
> Hello Fabio,
>
> Took a look on your sample projects - looks great! ;-) It works!
>
>> 4. If I create another diagram (a shape diagram or a simpleShape
>> diagram),
>> the old ones don't work any more. Two exceptions happens:
> Actually the problem is not in the creation of another diagram. Correct
> steps to reproduce it are:
> - Create one diagram and save it
> - Close this diagram
> - Create another diagram and save it
> - Try to reopen first diagram
> This problem was recently reported and fixed in 1.0.1 and 2.0 builds:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=153893
>
> You can get rid of this problem by updating your GMF to the corresponding
> versions and regenerating diagram code or by modifying following condition
> in both ShapeDocumentProviders:
>
> "nextResource != diagramResource" -> "nextResource != diagramResource &&
> nextResource.isLoaded()"
>
> Once you correct this problem you'll face another one: - Create new
> Diagram-1
> - Create new Diagram-2
> - Save both diagrams
> - Close and delete diagram+model files for Diagram-1
> - Modify and save Diagram-2 -> model file for Diagram-1 will be re-created
> To get rid of this problem you have to override disposeElementInfo()
> method in generated ShapeDocumentProvider. This method is responsible for
> unloading resources on closing corresponding diagram editor. Currently
> only diagram resource is unloaded there. You can modify this method to
> unload model file in addition.
>
> I'm going to create wiki page concerning step-by-step description of how
> to modify generated code to use shared editing domain across several
> diagrams. If you are interested - I can send you a link.
> -----------------
> Alex Shatalin
>
>
Re: Management of the plugin.xml [message #70435 is a reply to message #70272] Thu, 26 October 2006 16:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello Fabio,

Here is the corresponding wiki page: http://wiki.eclipse.org/index.php/GMF_Tips#Sharing_single_Ed itingDomain_instance_across_several_diagrams.
If you find any errors please notify me.

> thank you so much :-)). I didn't think I had to use the same
> clientContextID
Me too. I found it during debugging while writing this wiki page.

> If I would like to create a clientContext through code as described in
> "MultiPageEditor and ElementBinding (Dynamic editing domain ID) ",
> where could I create it ? Can I create it in the editor class ?
Probably yes, but this is a question mostly to the runtime team.

-----------------
Alex Shatalin
Re: Management of the plugin.xml [message #70473 is a reply to message #70435] Thu, 26 October 2006 20:08 Go to previous message
Eclipse UserFriend
Alex, thank you so much for documenting this topic!

Fabio, if you want to create a client context dynamically I think the
only thing you'll need to consider is that it be registered with the
ClientContextManager before your element types are required. The
diagram editor would be an appropriate spot unless your application has
another way to edit the model without the diagram being open.

--Linda


Alex Shatalin wrote:
> Hello Fabio,
>
> Here is the corresponding wiki page:
> http://wiki.eclipse.org/index.php/GMF_Tips#Sharing_single_Ed itingDomain_instance_across_several_diagrams.
> If you find any errors please notify me.
>
>> thank you so much :-)). I didn't think I had to use the same
>> clientContextID
> Me too. I found it during debugging while writing this wiki page.
>
>> If I would like to create a clientContext through code as described in
>> "MultiPageEditor and ElementBinding (Dynamic editing domain ID) ",
>> where could I create it ? Can I create it in the editor class ?
> Probably yes, but this is a question mostly to the runtime team.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:how to associate model objects with a Resource?
Next Topic:Creating Toolbar and Popup menu
Goto Forum:
  


Current Time: Sun Jun 01 07:32:59 EDT 2025

Powered by FUDForum. Page generated in 0.10482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top