Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How To Duplicate An EList
How To Duplicate An EList [message #148554] Thu, 30 August 2007 09:51 Go to next message
Eclipse UserFriend
Originally posted by: dan.krska.perspecsys.com

Hi all,

I've got what is probably a fairly unique situation here, caused by my use
of parent nodes, as well as bi-directional links. What I'm trying to do
is, for certain node types, limit the total number of connections they can
have (thus, a bi-directional link, so I can detect links both to and from
the node). However, since I only have one type of link for my diagram
(makes it simple for users), I've had to approach this through some code
alteration, as opposed to setting limits in the ecore file.

I've currently altered some of the code in the ParentNodeImpl (yeah, I
named my parent node ParentNode. Creative, aren't I?) class, and I've
gotten the link restrictions to work, at least visually. However, the
node properties will sometimes change, depending on how the links are
created (or at least, are tried to be created), and which node is selected
after the attempted link creation.

I believe a step towards my eventual solving of this problem would be to
be able to duplicate the ELists in which the connections are stored, so
that in case of an invalid connection, I can simply return the old ELists
instead of the newly altered ones, which should solve my problem (I'm not
quite sure how to approach THAT bit yet; this all seemed so much simpler
before I started typing this out). I've tried simply creating a new EList
and assigning it to equal the old one, but that didn't work, so I assume
thats not the way to do it.

Thanks in advance for any help, and sorry about the majorly long-winded
explanation of why I need to duplicate the ELists.

-Dan!
Re: How To Duplicate An EList [message #148572 is a reply to message #148554] Thu, 30 August 2007 11:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Dan,

The lists EMF is in generated models produce notifications as you make
changes in them and they are also designed to maintain reference
integrity so if you add some object the list holds to some other list,
the object may well be removed automatically. It doesn't sound like a
good idea to just switch lists to try to bypass all this. You can of
course create a copy of a list just using new ArrayList(originalList),
and you can use ECollections.setEList to set some existing EList to have
exactly the same contents and order as some other to some other list, so
maybe you want to use those techniques.


Dan! wrote:
> Hi all,
>
> I've got what is probably a fairly unique situation here, caused by my
> use of parent nodes, as well as bi-directional links. What I'm trying
> to do is, for certain node types, limit the total number of
> connections they can have (thus, a bi-directional link, so I can
> detect links both to and from the node). However, since I only have
> one type of link for my diagram (makes it simple for users), I've had
> to approach this through some code alteration, as opposed to setting
> limits in the ecore file.
>
> I've currently altered some of the code in the ParentNodeImpl (yeah, I
> named my parent node ParentNode. Creative, aren't I?) class, and I've
> gotten the link restrictions to work, at least visually. However, the
> node properties will sometimes change, depending on how the links are
> created (or at least, are tried to be created), and which node is
> selected after the attempted link creation.
>
> I believe a step towards my eventual solving of this problem would be
> to be able to duplicate the ELists in which the connections are
> stored, so that in case of an invalid connection, I can simply return
> the old ELists instead of the newly altered ones, which should solve
> my problem (I'm not quite sure how to approach THAT bit yet; this all
> seemed so much simpler before I started typing this out). I've tried
> simply creating a new EList and assigning it to equal the old one, but
> that didn't work, so I assume thats not the way to do it.
>
> Thanks in advance for any help, and sorry about the majorly
> long-winded explanation of why I need to duplicate the ELists.
>
> -Dan!
>
Re: How To Duplicate An EList [message #148625 is a reply to message #148572] Thu, 30 August 2007 14:04 Go to previous message
Eclipse UserFriend
Originally posted by: dan.krska.perspecsys.com

Hi Ed,

Thanks very much for your reply. I got the list duplication working, but
I'm starting to think that you're right in that this is not the proper way
to go about it. I've done some experimenting with other models, and it
looks like I need to rebuild everything from the .ecore file. Ah well,
not like I haven't had to do this before.

Thanks very much for your help and insight (I doubt I would've considered
alternatives to list duplication if it wasn't for your input) :)

-Dan!
Previous Topic:Localization of GMF editors
Next Topic:Problem while running the gmf digram plugin from an RCP application.
Goto Forum:
  


Current Time: Sat Jul 12 13:14:31 EDT 2025

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

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

Back to the top