Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how can I enable "delete from model" in synchronized diagrams.
how can I enable "delete from model" in synchronized diagrams. [message #23599] Fri, 18 August 2006 13:15 Go to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

I set diagram synchronized in gmfgen and generated the diagram, according to
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/tutorials/diagram/canonicalContainer.html,
then I change the extension "contributionItemProviders" in the plugin.xml to
make the "deleteFromDiagramAction" visualable in popup menu .

but the Action "deleteFromDiagramAction" is disabled in popup menu, because
of the ProcessDiagramCanonicalEditPolicy(), if I delete the
ProcessDiagramCanonicalEditPolicy(), then the Action
"deleteFromDiagramAction" is abled.

so If I install ProcessDiagramCanonicalEditPolicy() to make diagram
synchronized, then the "deleteFromDiagramAction" will be disabled. If I want
to make diagram synchronized, and the "deleteFromDiagramAction" enabled,
what should I do?

thank you.



Re: how can I enable "delete from model" in synchronized diagrams. [message #23818 is a reply to message #23599] Fri, 18 August 2006 17:23 Go to previous messageGo to next message
Eclipse UserFriend
dzh wrote:
> I set diagram synchronized in gmfgen and generated the diagram, according to
> http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/tutorials/diagram/canonicalContainer.html,
> then I change the extension "contributionItemProviders" in the plugin.xml to
> make the "deleteFromDiagramAction" visualable in popup menu .
>
> but the Action "deleteFromDiagramAction" is disabled in popup menu, because
> of the ProcessDiagramCanonicalEditPolicy(), if I delete the
> ProcessDiagramCanonicalEditPolicy(), then the Action
> "deleteFromDiagramAction" is abled.
>
> so If I install ProcessDiagramCanonicalEditPolicy() to make diagram
> synchronized, then the "deleteFromDiagramAction" will be disabled. If I want
> to make diagram synchronized, and the "deleteFromDiagramAction" enabled,
> what should I do?
>
> thank you.
>
>
Hi ;
The canonical behavior means the View will exist only if the semantic
element (model element) exist, and the view will be deleted as soon as
the semantic element is gone.
Based on this there is no point in enabling delete from diagram on the
canonical views because of 2 reasons:
1- if you delete the view only then the canonical edit policy will
recreate another similar view to represent semantic element.
2- delete from model will result in deleting both the semantic and the
view elements
Re: how can I enable "delete from model" in synchronized diagrams. [message #23979 is a reply to message #23818] Fri, 18 August 2006 23:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

> Hi ;
> The canonical behavior means the View will exist only if the semantic
> element (model element) exist, and the view will be deleted as soon as the
> semantic element is gone.
> Based on this there is no point in enabling delete from diagram on the
> canonical views because of 2 reasons:
> 1- if you delete the view only then the canonical edit policy will
> recreate another similar view to represent semantic element.

I want to change the ProcessDiagramCanonicalEditPolicy() to don't recreate
view of the semantic element ,if it does not have view.
I just want it to check if the view has its elment, and delete the view if
it doesn't have element.

> 2- delete from model will result in deleting both the semantic and the
> view elements

yes, I know that. But what about this case, I create view A with the element
C in diagram A, then I create view B with the same element C in diagram B
progammatically, and I want to enable "delete from diagram " in DiagramB,
because the elementC bleongs to the diagramA's model file, so canonical
behavior will not create view for DiagramB, am I right?

I had debug through the ProcessDiagramCanonicalEditPolicy() and relative
classes, but can't find the code disables "delete from diagram " action,
could you tell me which code disables the action?
Re: how can I enable "delete from model" in synchronized diagrams. [message #25019 is a reply to message #23979] Mon, 21 August 2006 12:06 Go to previous message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

> I had debug through the ProcessDiagramCanonicalEditPolicy() and relative
> classes, but can't find the code disables "delete from diagram " action,
> could you tell me which code disables the action?
>
finally ,I add a menu by myself with the "delete from diagram" function .
If you debug through the code, you will find that in the gmf runtime code it
will jude whether you have installed connonical editpolicy, if you do, it
will disable the "delete from diagram" function by returning null commond.
Previous Topic:figure of TextCompartmentEditPart is not visible
Next Topic:Icons in the outline's tree view
Goto Forum:
  


Current Time: Wed May 07 19:11:14 EDT 2025

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

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

Back to the top