Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to get editpart for semantic element or how to select semantic element in diagram
how to get editpart for semantic element or how to select semantic element in diagram [message #77550] Tue, 14 November 2006 13:02 Go to next message
Eclipse UserFriend
Hi.

I have found many ways to select elements in diagram but all those
methods expect editpart object[s] on input (encapsulated into
IStructuredSelection). I have a list of semantic elements and I would
like to select corresponding editparts in diagram editor, so:
how can I get editpart for semantic element or
or to directly select semantic element in given diagram.

Regards,
Seweryn
Re: how to get editpart for semantic element or how to select semantic element in diagram [message #77584 is a reply to message #77550] Tue, 14 November 2006 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Seweryn,

Take a look at the method
IDiagramGraphicalViewer.findEditPartsForElement(String elementIdStr,
Class editPartClass). Search for references to find an example of its
use in the CanonicalConnectionEditPolicy.

Regards,
Cherie

Seweryn Niemiec wrote:
> Hi.
>
> I have found many ways to select elements in diagram but all those
> methods expect editpart object[s] on input (encapsulated into
> IStructuredSelection). I have a list of semantic elements and I would
> like to select corresponding editparts in diagram editor, so:
> how can I get editpart for semantic element or
> or to directly select semantic element in given diagram.
>
> Regards,
> Seweryn
>
Re: how to get editpart for semantic element or how to select semantic element in diagram [message #77617 is a reply to message #77584] Tue, 14 November 2006 14:54 Go to previous messageGo to next message
Eclipse UserFriend
On Tue, 2006-11-14 at 13:13 -0500, Cherie Revells wrote:
> Seweryn,
>
> Take a look at the method
> IDiagramGraphicalViewer.findEditPartsForElement(String elementIdStr,
> Class editPartClass). Search for references to find an example of its
> use in the CanonicalConnectionEditPolicy.

Thank you very much, it works nice. Only one more question, why you use
Element ID Strings as keys in ElementToEditPartsMap instead of simply
Element object (by identity)?


tips for others:

1. get IDiagramGraphicalViewer:
for example
((IDiagramWorkbenchPart)yourDiagramEditor).getDiagramGraphic alViewer()

2. get all parts for your semantic element:
List editParts = diagramGraphicalViewer.findEditPartsForElement(
EMFCoreUtil.getProxyID(port),
PortEditPart.class
);

Regards,
Seweryn
Re: how to get editpart for semantic element or how to select semantic element in diagram [message #84193 is a reply to message #77617] Thu, 07 December 2006 15:21 Go to previous messageGo to next message
Eclipse UserFriend
List editParts = diagramGraphicalViewer.findEditPartsForElement(
EMFCoreUtil.getProxyID( <model>),
<ModelEditPart>.class
);

Great, but I don't know exactly what <model> do I have and what kind of
<ModelEditPart>.class should I use - I only know that someone has
selected something - any ideas?

thanx
Re: how to get editpart for semantic element or how to select semantic element in diagram [message #84207 is a reply to message #84193] Thu, 07 December 2006 15:36 Go to previous message
Eclipse UserFriend
Your solution is ok.
I forgot that when you give parent class as modelEditPart, all
childClass are accepted


Wiktor napisał(a):
>
> List editParts = diagramGraphicalViewer.findEditPartsForElement(
> EMFCoreUtil.getProxyID( <model>),
> <ModelEditPart>.class
> );
>
> Great, but I don't know exactly what <model> do I have and what kind of
> <ModelEditPart>.class should I use - I only know that someone has
> selected something - any ideas?
>
> thanx
Previous Topic:Request for SDO Sample with Library.xsd
Next Topic:Modifiying plugin.xml file
Goto Forum:
  


Current Time: Thu May 08 21:23:53 EDT 2025

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

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

Back to the top