Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to programmatically add an element as an owned element of another
How to programmatically add an element as an owned element of another [message #476536] Wed, 14 November 2007 10:48 Go to next message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Hi,

Given a new element (E.g., a CreateObjectAction), and an existing element
(E.g., Activity), I need to set the CreateObjectAction as a child or owned
element of the Activity. I tried using
Activity.getOwnedElements().add(theCreateObjectAction) and also
allOwnedElements().add() but I get a UnsupportedOperationException. Need
help on the right API to use.

Thanks,
Francis
Re: How to programmatically add an element as an owned element of another [message #476542 is a reply to message #476536] Thu, 15 November 2007 04:19 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Francis,

The ownedElement and allOwnedElement features are derived unions, and hence,
by definition, read-only. Try using Activity#createNode(String, EClass), or
if the action has already been created, you could add to the list returned
from Activity#getNodes().

Kenn

"Francis" <fgavino@gmail.com> wrote in message
news:48051760056b57a633176dcb8d74db34$1@www.eclipse.org...
> Hi,
>
> Given a new element (E.g., a CreateObjectAction), and an existing element
> (E.g., Activity), I need to set the CreateObjectAction as a child or owned
> element of the Activity. I tried using
> Activity.getOwnedElements().add(theCreateObjectAction) and also
> allOwnedElements().add() but I get a UnsupportedOperationException. Need
> help on the right API to use.
>
> Thanks,
> Francis
>
>
Re: How to programmatically add an element as an owned element of another [message #476635 is a reply to message #476542] Thu, 15 November 2007 20:55 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Francis,

To figure out if the collection you would like to add items to is derived
( and you actually have a life and don't want to figure this out from the
superstructure spec) then you can have a quick look at the interface at the
getter for the '@model' tag where derived=true. Derived unions calculate
their values from other properties that are defined to subset it. You can
also find subset information in the interface ( new in the M3 milestone ).

Cheers,

- James.


"Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
news:fhghbv$anl$1@build.eclipse.org...
> Francis,
>
> The ownedElement and allOwnedElement features are derived unions, and
> hence, by definition, read-only. Try using Activity#createNode(String,
> EClass), or if the action has already been created, you could add to the
> list returned from Activity#getNodes().
>
> Kenn
>
> "Francis" <fgavino@gmail.com> wrote in message
> news:48051760056b57a633176dcb8d74db34$1@www.eclipse.org...
>> Hi,
>>
>> Given a new element (E.g., a CreateObjectAction), and an existing element
>> (E.g., Activity), I need to set the CreateObjectAction as a child or
>> owned element of the Activity. I tried using
>> Activity.getOwnedElements().add(theCreateObjectAction) and also
>> allOwnedElements().add() but I get a UnsupportedOperationException. Need
>> help on the right API to use.
>>
>> Thanks,
>> Francis
>>
>>
>
>
Re: How to programmatically add an element as an owned element of another [message #625464 is a reply to message #476536] Thu, 15 November 2007 04:19 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Francis,

The ownedElement and allOwnedElement features are derived unions, and hence,
by definition, read-only. Try using Activity#createNode(String, EClass), or
if the action has already been created, you could add to the list returned
from Activity#getNodes().

Kenn

"Francis" <fgavino@gmail.com> wrote in message
news:48051760056b57a633176dcb8d74db34$1@www.eclipse.org...
> Hi,
>
> Given a new element (E.g., a CreateObjectAction), and an existing element
> (E.g., Activity), I need to set the CreateObjectAction as a child or owned
> element of the Activity. I tried using
> Activity.getOwnedElements().add(theCreateObjectAction) and also
> allOwnedElements().add() but I get a UnsupportedOperationException. Need
> help on the right API to use.
>
> Thanks,
> Francis
>
>
Re: How to programmatically add an element as an owned element of another [message #625473 is a reply to message #476542] Thu, 15 November 2007 20:55 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Francis,

To figure out if the collection you would like to add items to is derived
( and you actually have a life and don't want to figure this out from the
superstructure spec) then you can have a quick look at the interface at the
getter for the '@model' tag where derived=true. Derived unions calculate
their values from other properties that are defined to subset it. You can
also find subset information in the interface ( new in the M3 milestone ).

Cheers,

- James.


"Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
news:fhghbv$anl$1@build.eclipse.org...
> Francis,
>
> The ownedElement and allOwnedElement features are derived unions, and
> hence, by definition, read-only. Try using Activity#createNode(String,
> EClass), or if the action has already been created, you could add to the
> list returned from Activity#getNodes().
>
> Kenn
>
> "Francis" <fgavino@gmail.com> wrote in message
> news:48051760056b57a633176dcb8d74db34$1@www.eclipse.org...
>> Hi,
>>
>> Given a new element (E.g., a CreateObjectAction), and an existing element
>> (E.g., Activity), I need to set the CreateObjectAction as a child or
>> owned element of the Activity. I tried using
>> Activity.getOwnedElements().add(theCreateObjectAction) and also
>> allOwnedElements().add() but I get a UnsupportedOperationException. Need
>> help on the right API to use.
>>
>> Thanks,
>> Francis
>>
>>
>
>
Previous Topic:Questions in class and activity diagram
Next Topic:set stereotype attribute to other stereotype
Goto Forum:
  


Current Time: Thu Apr 25 17:15:11 GMT 2024

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

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

Back to the top