Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Programmatically moving Packages within an UML model
Re: Programmatically moving Packages within an UML model [message #477400] Mon, 19 May 2008 13:17 Go to next message
Ed Merks is currently offline Ed Merks
Messages: 26137
Registered: July 2009
Senior Member
Joakim,

It sounds like a question best asked on the UML2 newsgroup, which I've
added to the "to" list of the reply. Likely showing your stack trace
will be helpful for folks trying to understand what you've done.


Joakim Back wrote:
> Hello,
>
> I am working with a transformation aiming at adapting RSM models, to
> be compatible with tools previously used with Rose models.
>
> In the ModelRule, there is a desire to programatically move packages
> and content into a central Component. This has been possible with
> various content by creating clone packages, and moving content into
> the clones.
>
> An issue has arisen though with a Package that contains an Association
> to a Class in a sibling Package. The grand parent can be moved without
> issue to his clone, but when trying to move the content (say Packages
> A and B, where the Association is within A to a class in B) a
> ConcurrentModificationException arises.
>
> When moving the content through refactoring in Eclipse, there is no
> issue.
>
> Does anyone have clues to how to circumvent the problem, or since I am
> new to both the code and EMF in general, a different approach altogether?
>
>
> Best regards,
>
> Joakim
Re: Programmatically moving Packages within an UML model [message #477403 is a reply to message #477400] Mon, 19 May 2008 22:39 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael Chaves
Messages: 362
Registered: July 2009
Senior Member
Joakim,

How are you finding the element to move? Are you doing during a
traversal of the model element tree?

+1 show us your stack trace...

Rafael

Ed Merks wrote:
> Joakim,
>
> It sounds like a question best asked on the UML2 newsgroup, which I've
> added to the "to" list of the reply. Likely showing your stack trace
> will be helpful for folks trying to understand what you've done.
>
>
> Joakim Back wrote:
>> Hello,
>>
>> I am working with a transformation aiming at adapting RSM models, to
>> be compatible with tools previously used with Rose models.
>>
>> In the ModelRule, there is a desire to programatically move packages
>> and content into a central Component. This has been possible with
>> various content by creating clone packages, and moving content into
>> the clones.
>>
>> An issue has arisen though with a Package that contains an Association
>> to a Class in a sibling Package. The grand parent can be moved without
>> issue to his clone, but when trying to move the content (say Packages
>> A and B, where the Association is within A to a class in B) a
>> ConcurrentModificationException arises.
>>
>> When moving the content through refactoring in Eclipse, there is no
>> issue.
>>
>> Does anyone have clues to how to circumvent the problem, or since I am
>> new to both the code and EMF in general, a different approach altogether?
>>
>>
>> Best regards,
>>
>> Joakim
Re: Programmatically moving Packages within an UML model [message #477404 is a reply to message #477403] Tue, 20 May 2008 07:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: joakim.back.jayway.se

This is a multi-part message in MIME format.
--------------070109060301020507010303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

By reading the trace I gather the createTarget method (which contains
all the logic) is called within an iteration by IBM xtools, which is
obviously hazardous.

The moving is done by setNestingPackage.

A rephrase of the question is, is moving objects by nesting package a
valid approach, if done outside of an iteration?


Joakim

Rafael Chaves wrote:
> Joakim,
>
> How are you finding the element to move? Are you doing during a
> traversal of the model element tree?
>
> +1 show us your stack trace...
>
> Rafael
>
> Ed Merks wrote:
>> Joakim,
>>
>> It sounds like a question best asked on the UML2 newsgroup, which I've
>> added to the "to" list of the reply. Likely showing your stack trace
>> will be helpful for folks trying to understand what you've done.
>>
>>
>> Joakim Back wrote:
>>> Hello,
>>>
>>> I am working with a transformation aiming at adapting RSM models, to
>>> be compatible with tools previously used with Rose models.
>>>
>>> In the ModelRule, there is a desire to programatically move packages
>>> and content into a central Component. This has been possible with
>>> various content by creating clone packages, and moving content into
>>> the clones.
>>>
>>> An issue has arisen though with a Package that contains an
>>> Association to a Class in a sibling Package. The grand parent can be
>>> moved without issue to his clone, but when trying to move the content
>>> (say Packages A and B, where the Association is within A to a class
>>> in B) a ConcurrentModificationException arises.
>>>
>>> When moving the content through refactoring in Eclipse, there is no
>>> issue.
>>>
>>> Does anyone have clues to how to circumvent the problem, or since I
>>> am new to both the code and EMF in general, a different approach
>>> altogether?
>>>
>>>
>>> Best regards,
>>>
>>> Joakim


--------------070109060301020507010303
Content-Type: text/plain;
name="trace.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;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VNVQkVOVFJZIDIgY29tLmlibS54dG9vbHMu dHJhbnNmb3Jt
LmNvcmUgNCAxMiAyMDA4LTA1LTE5IDA5OjMzOjM5LjU5OA0KIU1FU1NBR0Ug VHJhbnNmb3Jt
IEZpeCBSb3NlIEltcG9ydDogIEVsZW1lbnQgImNvbS5lbXBsb3llci5jb2Rl dHJhbnNsYXRv
ci50cmFuc2Zvcm1zLkZpeFJvc2VJbXBvcnRUcmFuc2Zvcm0ucm9vdC5saXN0 IiB3YXMgZXhl
Y3V0aW5nIHNvdXJjZSAiW29yZy5lY2xpcHNlLnVtbDIudW1sLmludGVybmFs LmltcGwuTW9k
ZWxJbXBsQDYwN2M2MDdjIChuYW1lOiBFYmNUZXN0MDQsIHZpc2liaWxpdHk6 IDx1bnNldD4p
ICh2aXNpYmlsaXR5OiBwdWJsaWMpICh2aWV3cG9pbnQ6IDx1bnNldD4pXSIN CiA=
--------------070109060301020507010303--
Re: Programmatically moving Packages within an UML model [message #477405 is a reply to message #477404] Tue, 20 May 2008 14:55 Go to previous message
Rafael Chaves is currently offline Rafael Chaves
Messages: 362
Registered: July 2009
Senior Member
I would say so and it would be the same as removing it from the
collection of children of the existing parent and adding it to the new one.

You just need to make sure you don't make changes to a collection of
objects while you are iterating it. One possible way to do that is to
collect the changes to perform during the traversal, but not actually do
then, and perform them right after the traversal finishes. There might
be better ways though.

Cheers,

Rafael

Joakim Back wrote:
> By reading the trace I gather the createTarget method (which contains
> all the logic) is called within an iteration by IBM xtools, which is
> obviously hazardous.
>
> The moving is done by setNestingPackage.
>
> A rephrase of the question is, is moving objects by nesting package a
> valid approach, if done outside of an iteration?
>
>
> Joakim
>
> Rafael Chaves wrote:
>> Joakim,
>>
>> How are you finding the element to move? Are you doing during a
>> traversal of the model element tree?
>>
>> +1 show us your stack trace...
>>
>> Rafael
>>
>> Ed Merks wrote:
>>> Joakim,
>>>
>>> It sounds like a question best asked on the UML2 newsgroup, which
>>> I've added to the "to" list of the reply. Likely showing your stack
>>> trace will be helpful for folks trying to understand what you've done.
>>>
>>>
>>> Joakim Back wrote:
>>>> Hello,
>>>>
>>>> I am working with a transformation aiming at adapting RSM models, to
>>>> be compatible with tools previously used with Rose models.
>>>>
>>>> In the ModelRule, there is a desire to programatically move packages
>>>> and content into a central Component. This has been possible with
>>>> various content by creating clone packages, and moving content into
>>>> the clones.
>>>>
>>>> An issue has arisen though with a Package that contains an
>>>> Association to a Class in a sibling Package. The grand parent can be
>>>> moved without issue to his clone, but when trying to move the
>>>> content (say Packages A and B, where the Association is within A to
>>>> a class in B) a ConcurrentModificationException arises.
>>>>
>>>> When moving the content through refactoring in Eclipse, there is no
>>>> issue.
>>>>
>>>> Does anyone have clues to how to circumvent the problem, or since I
>>>> am new to both the code and EMF in general, a different approach
>>>> altogether?
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Joakim
>
Re: Programmatically moving Packages within an UML model [message #626585 is a reply to message #477400] Mon, 19 May 2008 22:39 Go to previous message
Rafael Chaves is currently offline Rafael Chaves
Messages: 362
Registered: July 2009
Senior Member
Joakim,

How are you finding the element to move? Are you doing during a
traversal of the model element tree?

+1 show us your stack trace...

Rafael

Ed Merks wrote:
> Joakim,
>
> It sounds like a question best asked on the UML2 newsgroup, which I've
> added to the "to" list of the reply. Likely showing your stack trace
> will be helpful for folks trying to understand what you've done.
>
>
> Joakim Back wrote:
>> Hello,
>>
>> I am working with a transformation aiming at adapting RSM models, to
>> be compatible with tools previously used with Rose models.
>>
>> In the ModelRule, there is a desire to programatically move packages
>> and content into a central Component. This has been possible with
>> various content by creating clone packages, and moving content into
>> the clones.
>>
>> An issue has arisen though with a Package that contains an Association
>> to a Class in a sibling Package. The grand parent can be moved without
>> issue to his clone, but when trying to move the content (say Packages
>> A and B, where the Association is within A to a class in B) a
>> ConcurrentModificationException arises.
>>
>> When moving the content through refactoring in Eclipse, there is no
>> issue.
>>
>> Does anyone have clues to how to circumvent the problem, or since I am
>> new to both the code and EMF in general, a different approach altogether?
>>
>>
>> Best regards,
>>
>> Joakim
Re: Programmatically moving Packages within an UML model [message #626586 is a reply to message #477403] Tue, 20 May 2008 07:20 Go to previous message
Eclipse User
Originally posted by: joakim.back.jayway.se

This is a multi-part message in MIME format.
--------------070109060301020507010303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

By reading the trace I gather the createTarget method (which contains
all the logic) is called within an iteration by IBM xtools, which is
obviously hazardous.

The moving is done by setNestingPackage.

A rephrase of the question is, is moving objects by nesting package a
valid approach, if done outside of an iteration?


Joakim

Rafael Chaves wrote:
> Joakim,
>
> How are you finding the element to move? Are you doing during a
> traversal of the model element tree?
>
> +1 show us your stack trace...
>
> Rafael
>
> Ed Merks wrote:
>> Joakim,
>>
>> It sounds like a question best asked on the UML2 newsgroup, which I've
>> added to the "to" list of the reply. Likely showing your stack trace
>> will be helpful for folks trying to understand what you've done.
>>
>>
>> Joakim Back wrote:
>>> Hello,
>>>
>>> I am working with a transformation aiming at adapting RSM models, to
>>> be compatible with tools previously used with Rose models.
>>>
>>> In the ModelRule, there is a desire to programatically move packages
>>> and content into a central Component. This has been possible with
>>> various content by creating clone packages, and moving content into
>>> the clones.
>>>
>>> An issue has arisen though with a Package that contains an
>>> Association to a Class in a sibling Package. The grand parent can be
>>> moved without issue to his clone, but when trying to move the content
>>> (say Packages A and B, where the Association is within A to a class
>>> in B) a ConcurrentModificationException arises.
>>>
>>> When moving the content through refactoring in Eclipse, there is no
>>> issue.
>>>
>>> Does anyone have clues to how to circumvent the problem, or since I
>>> am new to both the code and EMF in general, a different approach
>>> altogether?
>>>
>>>
>>> Best regards,
>>>
>>> Joakim


--------------070109060301020507010303
Content-Type: text/plain;
name="trace.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="trace.txt"

IUVOVFJZIGNvbS5pYm0ueHRvb2xzLnRyYW5zZm9ybS5jb3JlIDQgMTIgMjAw OC0wNS0xOSAw
OTozMzozOS41OTgNCiFNRVNTQUdFIElSSkgwMDEyRS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EZpeCBSb3NlIEltcG9ydDogIEVsZW1lbnQgImNvbS5lbXBsb3llci5jb2Rl dHJhbnNsYXRv
ci50cmFuc2Zvcm1zLkZpeFJvc2VJbXBvcnRUcmFuc2Zvcm0ucm9vdC5saXN0 IiB3YXMgZXhl
Y3V0aW5nIHNvdXJjZSAiW29yZy5lY2xpcHNlLnVtbDIudW1sLmludGVybmFs LmltcGwuTW9k
ZWxJbXBsQDYwN2M2MDdjIChuYW1lOiBFYmNUZXN0MDQsIHZpc2liaWxpdHk6 IDx1bnNldD4p
ICh2aXNpYmlsaXR5OiBwdWJsaWMpICh2aWV3cG9pbnQ6IDx1bnNldD4pXSIN CiA=
--------------070109060301020507010303--
Re: Programmatically moving Packages within an UML model [message #626587 is a reply to message #477404] Tue, 20 May 2008 14:55 Go to previous message
Rafael Chaves is currently offline Rafael Chaves
Messages: 362
Registered: July 2009
Senior Member
I would say so and it would be the same as removing it from the
collection of children of the existing parent and adding it to the new one.

You just need to make sure you don't make changes to a collection of
objects while you are iterating it. One possible way to do that is to
collect the changes to perform during the traversal, but not actually do
then, and perform them right after the traversal finishes. There might
be better ways though.

Cheers,

Rafael

Joakim Back wrote:
> By reading the trace I gather the createTarget method (which contains
> all the logic) is called within an iteration by IBM xtools, which is
> obviously hazardous.
>
> The moving is done by setNestingPackage.
>
> A rephrase of the question is, is moving objects by nesting package a
> valid approach, if done outside of an iteration?
>
>
> Joakim
>
> Rafael Chaves wrote:
>> Joakim,
>>
>> How are you finding the element to move? Are you doing during a
>> traversal of the model element tree?
>>
>> +1 show us your stack trace...
>>
>> Rafael
>>
>> Ed Merks wrote:
>>> Joakim,
>>>
>>> It sounds like a question best asked on the UML2 newsgroup, which
>>> I've added to the "to" list of the reply. Likely showing your stack
>>> trace will be helpful for folks trying to understand what you've done.
>>>
>>>
>>> Joakim Back wrote:
>>>> Hello,
>>>>
>>>> I am working with a transformation aiming at adapting RSM models, to
>>>> be compatible with tools previously used with Rose models.
>>>>
>>>> In the ModelRule, there is a desire to programatically move packages
>>>> and content into a central Component. This has been possible with
>>>> various content by creating clone packages, and moving content into
>>>> the clones.
>>>>
>>>> An issue has arisen though with a Package that contains an
>>>> Association to a Class in a sibling Package. The grand parent can be
>>>> moved without issue to his clone, but when trying to move the
>>>> content (say Packages A and B, where the Association is within A to
>>>> a class in B) a ConcurrentModificationException arises.
>>>>
>>>> When moving the content through refactoring in Eclipse, there is no
>>>> issue.
>>>>
>>>> Does anyone have clues to how to circumvent the problem, or since I
>>>> am new to both the code and EMF in general, a different approach
>>>> altogether?
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Joakim
>
Previous Topic:Proposed criteria for editing property subsets and element redefinitions
Next Topic:Copy-paste Association as a side-effect when pasting a Class
Goto Forum:
  


Current Time: Thu Oct 23 04:32:15 GMT 2014

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

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