Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Retrieve EditPart by EObject and Diagram
Retrieve EditPart by EObject and Diagram [message #225796] Tue, 14 April 2009 12:31 Go to next message
Eclipse UserFriend
Originally posted by: ralph.schreder.gmx.de

Hi All!

Is there a possiblity to retrieve the EditPart that "represents" an EObject
in a diagram from the EObject itself?

I haven't found a solution for that problem! Any help appreciated!!!

protected EContentsEList.FeatureIterator<EObject>
getCrossReferences(EObject eObject)
{
EContentsEList.FeatureIterator<EObject> iter =
(EContentsEList.FeatureIterator<EObject>)
((InternalEList<EObject>)eObject.eCrossReferences()).basicIterator();
return iter;
}


I found an answer (2008), but I can´t understand it. I get null elements
for
CrossReferencer-Iterator.
The answer to the question in the email:
(Use CrossReferencer or traverse Notation model manually to find
corresponding notation model element. Then using
EditPartViewer.getEditPartRegistry() you can get EditPart associated
with this View.)

Thanks in advance,

Ralph
Re: Retrieve EditPart by EObject and Diagram [message #225825 is a reply to message #225796] Tue, 14 April 2009 12:52 Go to previous message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Ralph,

In GMF, the ecore model used is agnostic of GMF API, if you want fetch
corresponding EditPart you must get RootEditPart corresponding to you
root model element and iterate through childs (perhaps with
getChildBySemanticHint() ) and check with getHostObject() if the current
EditPart correspond to your EObject.


Ralph a écrit :
> Hi All!
>
> Is there a possiblity to retrieve the EditPart that "represents" an EObject
> in a diagram from the EObject itself?
>
> I haven't found a solution for that problem! Any help appreciated!!!
>
> protected EContentsEList.FeatureIterator<EObject>
> getCrossReferences(EObject eObject)
> {
> EContentsEList.FeatureIterator<EObject> iter =
> (EContentsEList.FeatureIterator<EObject>)
> ((InternalEList<EObject>)eObject.eCrossReferences()).basicIterator();
> return iter;
> }
>
>
> I found an answer (2008), but I can´t understand it. I get null elements
> for
> CrossReferencer-Iterator.
> The answer to the question in the email:
> (Use CrossReferencer or traverse Notation model manually to find
> corresponding notation model element. Then using
> EditPartViewer.getEditPartRegistry() you can get EditPart associated
> with this View.)
>
> Thanks in advance,
>
> Ralph
Previous Topic:How to get the figures and their acions in the GMF editor?
Next Topic:how can i make a figure inmobile
Goto Forum:
  


Current Time: Fri Apr 19 05:15:32 GMT 2024

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

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

Back to the top