Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » method creation/deletion inside model
method creation/deletion inside model [message #235579] Tue, 07 July 2009 17:03 Go to next message
Eclipse UserFriend
Originally posted by: watertext.hotmail.it

Greetings, i have a diagram editor (extends ecorediagrameditor) that
programmatically needs to add/remove/change the methods inside the classes
on the diagram.

I noticed that inside the EObject (
IGraphicalEditPart.getModel().getElement() ) i could get the methods using
eobject.getEOperations() but i dont know how to replace them inside the
model with a new EList

Its possible to do that and refresh my diagram if needed?

getEOperations() is the right method to do it?

thanks for your time, bye.
Re: method creation/deletion inside model [message #235611 is a reply to message #235579] Wed, 08 July 2009 09:59 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Max,

> I noticed that inside the EObject (
You are probably talking about EClass.eOperations() method..
Then you can modify returned collection and corresponding modifications will
be propagated to the model/diagram should be updated in accordance.

-----------------
Alex Shatalin
Re: method creation/deletion inside model [message #235802 is a reply to message #235611] Thu, 09 July 2009 13:15 Go to previous message
Eclipse UserFriend
Originally posted by: watertext.hotmail.it

Hi Alex, yes you were right, it's a method from EClass, i forgot to notice
the cast.
I was interested to modify the name of the Operation, i was able to do so
using the right command:
--------------------
Object newname = new String("myNewMethodName");
EditingDomain editingDomain =
((EcoreDiagramEditor)editor).getDiagramEditPart().getEditing Domain();
EOperation eop = eclass.getEOperations().get(0);

editingDomain.getCommandStack().execute(SetCommand.create(ed itingDomain,
eop, EcorePackage.Literals.ENAMED_ELEMENT__NAME , newname));

----------

Thanks for your help, bye.

"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:3c3172e62e8e48cbcddaa01ca550@news.eclipse.org...
> Hello Max,
>
>> I noticed that inside the EObject (
> You are probably talking about EClass.eOperations() method..
> Then you can modify returned collection and corresponding modifications
> will be propagated to the model/diagram should be updated in accordance.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Connections disappear between shortcut elements on refresh/reload
Next Topic:Open diagram impractical with new WrappingLabel
Goto Forum:
  


Current Time: Wed Mar 03 03:34:30 GMT 2021

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

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

Back to the top