|
Re: Get Editpart from semantic element [message #195914 is a reply to message #195829] |
Mon, 07 July 2008 08:34 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02473 seconds