Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem with EditPart and Impl
Problem with EditPart and Impl [message #232532] Fri, 05 June 2009 09:06 Go to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Hi, I have to hide a node B when I click on oneother node A. In my
meta-model A has a reference to B. I install an OpenEditPolicy in A so
when I double-click on A I can hide B. From the EditPart A I call "aview =
(View)A.getModel()" to obtain the model of A. Now I can get B calling "b =
aview.getB()".. The class of b is "BImpl". Now, how can I hide B using
this BImpl class? I try to cast as View but I get an error. There is a
way to get the EditPart of B starting from the BImpl class?
Thanks
Re: Problem with EditPart and Impl [message #232540 is a reply to message #232532] Fri, 05 June 2009 09:15 Go to previous messageGo to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Sorry i forget a step..
When I obtain the view "aview" I call "(A)aview.getElement()" to get the
model and I obtain an "AImpl" instance and then I call "getB" to get
"BImpl".
Re: Problem with EditPart and Impl [message #232624 is a reply to message #232540] Fri, 05 June 2009 11:24 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Giordano,

Having BImpl you should traverse all Nodes starting from the current diagram
to find notation model element (Node) representing BImpl on this diagram.
Then you can use EditPartRegistry to find EditPart representing this view
like: EditPartViewer.getEditPartRegistry().get(<Node>).

EditPartViewer is available form any EditPart - there is .getViewer() method.

-----------------
Alex Shatalin
Re: Problem with EditPart and Impl [message #232638 is a reply to message #232540] Fri, 05 June 2009 11:28 Go to previous messageGo to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Can anyone help me?
Re: Problem with EditPart and Impl [message #232653 is a reply to message #232624] Fri, 05 June 2009 11:29 Go to previous messageGo to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Thanks!! now I try!!
Re: Problem with EditPart and Impl [message #232698 is a reply to message #232624] Fri, 05 June 2009 11:57 Go to previous messageGo to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Your method works only when EditPart is visible.. when I hide B
getEditPartRegistry returns null..
How can I handle this? I need to show B the next time I double-click on A!
Thanks for your time!!
Re: Problem with EditPart and Impl [message #232729 is a reply to message #232698] Fri, 05 June 2009 13:15 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Giordano,

> How can I handle this? I need to show B the next time I double-click
> on A!
How do you hide B? If you are calling View.setVisible() then you do not need
EditPart..

-----------------
Alex Shatalin
Re: Problem with EditPart and Impl [message #232745 is a reply to message #232729] Fri, 05 June 2009 13:46 Go to previous messageGo to next message
Giordano is currently offline GiordanoFriend
Messages: 21
Registered: July 2009
Junior Member
Ok you have right I can change visibility also in Node instance. Now it's
working! Thanks!!!
Re: Problem with EditPart and Impl [message #232849 is a reply to message #232638] Mon, 08 June 2009 06:43 Go to previous message
Daniel Rippel is currently offline Daniel RippelFriend
Messages: 29
Registered: July 2009
Junior Member
I'm not if this can help if the View of EObject B is invisible, but the
simples method to get from an EObject to a View Object is by calling:

ViewUtil.getViewContainer(EObject)

Something similar is possible to get an editpart (if the editor is open
and focussed by calling

..findEditPart(EditPart epToBegin,EObject theElement)

this must be called on any parent of the editpart your're looking for
which then is the first argument as well (I always take the
DiagramEditPart).theElement corresponds to the semantic element for
which you search the editpart.

I'm not sure if they work if the editpart is hidden, but I can't imagine
why not :)

Hope that helps,
Daniel

Giordano schrieb:
> Can anyone help me?
>
Previous Topic:Reset The Saved Document in XXXDocumentProvider
Next Topic:OVERRIDING ECLIPSE MENUS
Goto Forum:
  


Current Time: Sat Apr 20 04:06:48 GMT 2024

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

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

Back to the top