Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Delete from model/diagram(can't enable delete from model/diagram)
Delete from model/diagram [message #848680] Wed, 18 April 2012 13:30 Go to next message
maxime r is currently offline maxime rFriend
Messages: 6
Registered: April 2012
Junior Member
I'm quiet new to GFM and I have some problems
I don't find how to enable "Delete from model" and "Delete from Diagram" on the context menu.
I tried lots of thing, the better thing I found is to comment:
new Aramisbp_model.diagram.edit.policies.ClassDescriptionItemSemanticEditPolicy());

With that when I press del, delete from diagram is done, but I can't delete object from my model, and Delete from Diagram is not on the context menu.

Appreciate the help! Smile
Re: Delete from model/diagram [message #855455 is a reply to message #848680] Tue, 24 April 2012 21:00 Go to previous messageGo to next message
Arto Jarvinen is currently offline Arto JarvinenFriend
Messages: 32
Registered: May 2010
Location: Sweden
Hi, don't you see any of these two menus? When I set the Diagram -> Synchronized property to true I only get "Delete from Model" activated which makes sense since the diagram and the (domain) model shall be in total sync. When I set it to false which is what I really want to do, both "Delete from Model" and "Delete from Diagram" appear. Again this makes sense since I want to be able to have stuff in the domain model that doesn't show in every diagram. (If this latter case one has to think a bit about what "Delete from Model" means. I for instance need to delete all view elements representing the domain model element I wish to delete which is not the default behavior.) The global Delete menu remains greyed out in my case though which I don't understand - yet. -A

Re: Delete from model/diagram [message #885549 is a reply to message #848680] Wed, 13 June 2012 08:31 Go to previous messageGo to next message
supermmao supermmao is currently offline supermmao supermmaoFriend
Messages: 1
Registered: June 2012
Junior Member
hi,do you solve this problem now?
maybe this method can help you:
1. modify DiagramEditorContextMenuProvider's method:
public void buildContextMenu(...) {
public void run() {
// add this line
menu.remove(ActionIds.ACTION_DELETE_FROM_DIAGRAM); // remove "delete from
// diagram" action
2. in the XXXEditPart's createDefaultEditPolicies(),add this line:
installEditPolicy(EditPolicy.CONNECTION_ROLE, new XXXEditPolicy());
3. then create a class,names XXXEditPolicy:
public class XXXEditPolicy extends ConnectionEditPolicy{

protected boolean shouldDeleteSemantic() { // override this method,
// make shouldDeleteSemantic()
// return true;
return true;

Through the 3 steps,you can forbid the "delete from diagram",if you press the "delete", the element can be deleted from model.
But when you press the "delete" or "backspace", it will pop-up a message dialog.If you don't want it pops up dialog, you can override the createDeleteSemanticCommand method of ConnectionEditPolicy in XXXEditPolicy:
protected Command createDeleteSemanticCommand(...) {
semReq =
new EditCommandRequestWrapper(new DestroyElementRequest(editingDomain,
false), ....); // use false replaces
// grDeleteRequest.isShowInformationDialog()
Re: Delete from model/diagram [message #888776 is a reply to message #885549] Mon, 18 June 2012 15:59 Go to previous message
maxime r is currently offline maxime rFriend
Messages: 6
Registered: April 2012
Junior Member
Thank you for having responded,
I did't try your reply but when i exported it to an eclipse RCP application, "Delete from model" and "Delete from Diagram" are available.

Previous Topic:Question compartments
Next Topic:GMF Tooling Runtime Missing in Juno 4.2 RC2/RC3
Goto Forum:

Current Time: Wed Aug 23 06:29:10 GMT 2017

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

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