Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get Editpart from semantic element
Get Editpart from semantic element [message #195829] Sat, 05 July 2008 14:33 Go to next message
Guillaume Gauffre is currently offline Guillaume GauffreFriend
Messages: 65
Registered: July 2009
Member
Hi,

I would like to know how to navigating between semantic elements (domain
elements), editparts, notation views, and figures.
I'm really lost when I need to get one of them from another one.
Thank you.

Guillaume
Re: Get Editpart from semantic element [message #195914 is a reply to message #195829] Mon, 07 July 2008 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janiko.gmx.de

Guillaume Gauffre schrieb:
> Hi,
>
> I would like to know how to navigating between semantic elements (domain
> elements), editparts, notation views, and figures.
> I'm really lost when I need to get one of them from another one.
> Thank you.
>
> Guillaume

You can get a EditPart from a EObject with:
XXXEditPart.findEditPart(<EditPart to start>, <EObcejt>)

Thats may help you on a first step.

Tony
Re: Get Editpart from semantic element [message #195929 is a reply to message #195829] Mon, 07 July 2008 08:45 Go to previous message
Eclipse UserFriend
Originally posted by: lunaris.bluemoon.gmail.com

Hi Guillaume,

If you have an IDiagramGraphicalViewer you have another option: you can
use the findEditPartsForElement(String elementIdStr, Class
editPartClass) method. This returns a list of possible EditParts for
you. Try the following snippet:

/*
* You have to get this somehow; a couple of options:
*
* 1. Try anEditPart.getCurrentViewer()
* 2. If you're in an action / palette tool, you may have access
* to a getDiagramGraphicalViewer() method or similar.
*/
IDiagramGraphicalViewer viewer = ...

// Your semantic element
EObject elementToResolve = ...

/*
* You could also try substituting in a more specific class than
* EditPart here.
*/
List editParts =
viewer.findEditPartsForElement(
EMFCoreUtil.getProxyId(elementToResolve),
EditPart.class);

if (!editParts.isEmpty()) {
// What you do here is up to you, possibly:
EditPart resolvedEditPart = (EditPart)editParts.get(0);

// Do something with EditPart
}

Hope this helps / is correct for GMF veterans :)

Good luck,
Will

Guillaume Gauffre wrote:
> Hi,
>
> I would like to know how to navigating between semantic elements (domain
> elements), editparts, notation views, and figures.
> I'm really lost when I need to get one of them from another one.
> Thank you.
>
> Guillaume
Previous Topic:Using Dialog box or Wizards to Edit model objects
Next Topic:How to remove elements from non-synchronized diagrams
Goto Forum:
  


Current Time: Fri Apr 19 07:15:59 GMT 2024

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

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

Back to the top