How to filter out GMF references [message #629261] |
Mon, 27 September 2010 15:41 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
Hello all,
I create a cross referencer to determine all inverse references of an
EObject. If it has no inverse references I want to delete it. The
problem is that if the EObject will be created with a GMF editor it has
an inverse reference from its shape. Now I want to know if it is
possible to filter out those GMF references because for me they don't
play a role. So to say, I want to delete the EObject if it only has an
inverse reference of its own GMF presentation. How can I achieve this?
Here some code where you can see what I want:
EObject removal =...;
Collection<Setting> references =
crossReferencer.getNonNavigableInverseReferences(removal, true);
if(references.size() == 1){
for (Setting setting : references) {
EObject referer = setting.getEObject();
// pseudo
if(referer is GMF shape of removal){
//remove removal
}
}
}
|
|
|
|
Re: How to filter out GMF references [message #629477 is a reply to message #629388] |
Tue, 28 September 2010 12:19 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
Ed Merks wrote:
> Gilbert,
>
> If you know which feature always does the referencing you can filter out
> based on that. Otherwise you could do an instanceof check on the referer.
Yes the instanceof check could make it. But I wanted to avoid to include
GMF dependencies in that plugin. But I assume that I have to do that.
|
|
|
|
Re: How to filter out GMF references [message #629663 is a reply to message #629631] |
Wed, 29 September 2010 07:45 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
Hi Ed,
yes my domain model is in a separate resource. Not visiting the graph
would do the trick but isn't possible in my use case. I do a kind of
refactoring which should be independent from the model's representation.
That means I would like to invoke the removement of the mentioned
elements in a textual editor, as well as in the GMF editor. For that
reason I implemented some kind of editor connector which returns the
underlying EObjects from the selection in the respective editor. So to
say, the removal algorithm should only work on the EObjects and the
representation should refresh. Well I worry about doing an instanceof
check or checking the referencing GMF feature, as you said. Not so nice
but I think it will work.
best regards,
Gilbert
Ed Merks wrote:
> Gilbert,
>
> Alternatively you avoid visiting the graph of GMF objects entirely. Not
> sure if your domain model is in a separate resource...
>
>
> Gilbert Mirenque wrote:
>> Ed Merks wrote:
>>
>>> Gilbert,
>>>
>>> If you know which feature always does the referencing you can filter out
>>> based on that. Otherwise you could do an instanceof check on the
>>> referer.
>>>
>> Yes the instanceof check could make it. But I wanted to avoid to include
>> GMF dependencies in that plugin. But I assume that I have to do that.
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03571 seconds