Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to make a node undeletable
how to make a node undeletable [message #150903] Sun, 16 September 2007 11:29 Go to next message
Eclipse UserFriend
Originally posted by: fanshuchuan.163.com

Hi, is there anyone who knows how to make a node undeleteable?
Re: how to make a node undeletable [message #150913 is a reply to message #150903] Mon, 17 September 2007 01:41 Go to previous messageGo to next message
Eclipse UserFriend
Try this :-

inside the ItemSemanticEditPolicy of the editpart you wish to make
undeletable override the getDestroyElementCommand() method in th following
way

protected Command getDestroyElementCommand(DestroyElementRequest req) {

return UnexecutableCommand.INSTANCE;

}

this should work.

cheers,
-Arpit
Re: how to make a node undeletable [message #151102 is a reply to message #150913] Mon, 17 September 2007 03:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fanshuchuan.163.com

Arpit, thanks for your answer.
I tried the way you mentioned, and it works when i choose the "delete
from model" popup menu. but the node can still be removed when i press
"delete" shortcut key or choose the system menu "edit/delete".
so i wonder whether there is another way to solve the problem.

peter Fan
Re: how to make a node undeletable [message #151267 is a reply to message #151102] Mon, 17 September 2007 06:35 Go to previous message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Install a ComponentEditPolicy like this:


installEditPolicy(EditPolicy.COMPONENT_ROLE,
new ComponentEditPolicy(){
protected Command getDeleteCommand(GroupRequest request) {
return null;
}
}
);


fan schrieb:
> Arpit, thanks for your answer.
> I tried the way you mentioned, and it works when i choose the "delete
> from model" popup menu. but the node can still be removed when i press
> "delete" shortcut key or choose the system menu "edit/delete".
> so i wonder whether there is another way to solve the problem.
>
> peter Fan
>
Previous Topic:changes in ecore model effect other models?
Next Topic:automatically generate child elements vs. deserialization
Goto Forum:
  


Current Time: Fri Jul 04 03:20:10 EDT 2025

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

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

Back to the top