Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to filter out GMF references
How to filter out GMF references [message #629261] Mon, 27 September 2010 15:41 Go to next message
Eclipse UserFriend
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 #629388 is a reply to message #629261] Tue, 28 September 2010 06:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
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.


Gilbert Mirenque wrote:
> 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 Go to previous messageGo to next message
Eclipse UserFriend
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 #629631 is a reply to message #629477] Wed, 29 September 2010 03:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090100000006060207090705
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

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.
>

--------------090100000006060207090705
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilbert,<br>
<br>
Alternatively you avoid visiting the graph of GMF objects entirely. 
Not sure if your domain model is in a separate resource...<br>
<br>
<br>
Gilbert Mirenque wrote:
<blockquote cite="mid:i7smas$rf$1@news.eclipse.org" type="cite">
<pre wrap="">
Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap=""><!---->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.
</pre>
</blockquote>
</body>
</html>

--------------090100000006060207090705--
Re: How to filter out GMF references [message #629663 is a reply to message #629631] Wed, 29 September 2010 07:45 Go to previous message
Eclipse UserFriend
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.
>>
>
Previous Topic:EMF Ant tasks
Next Topic:Restriction Of Complex Types Not Validating
Goto Forum:
  


Current Time: Wed Oct 23 19:39:21 GMT 2019

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

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

Back to the top