Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » select an editpart from the outline?
select an editpart from the outline? [message #528900] Thu, 22 April 2010 10:47 Go to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
Hello,
I work on an application that use EMF and GEF.
I want that when I select an element from the outline, the appropriate editpart should be selected in the GEF page.

I modified the method generated by EMF : handleContentOutlineSelection(ISelection selection)
so that it informs the GEF page about the selected model
for that I create a method setInput(object)
((GraphicalGeditorEditor) getActiveEditor()).setInput( selectedElements.get(0))

In the Gef page I recuperate the editpart according to the model type, the problem is that I coudn't find the appropriate method to select this editpart, I tried these methods : select(editpart) reveal(editpart) setselection(Iselection) but it that doesn't work.
any Help?
thank's in advance.
Re: select an editpart from the outline? [message #529032 is a reply to message #528900] Thu, 22 April 2010 16:45 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
On 22/04/2010 11:47, nd786mar1 wrote:
> Hello,
> I work on an application that use EMF and GEF.
> I want that when I select an element from the outline, the appropriate
> editpart should be selected in the GEF page.
>
> I modified the method generated by EMF :
> handleContentOutlineSelection(ISelection selection)
> so that it informs the GEF page about the selected model
> for that I create a method setInput(object)
> ((GraphicalGeditorEditor) getActiveEditor()).setInput(
> selectedElements.get(0))
>
> In the Gef page I recuperate the editpart according to the model type,
> the problem is that I coudn't find the appropriate method to select this
> editpart, I tried these methods : select(editpart) reveal(editpart)
> setselection(Iselection) but it that doesn't work.
> any Help?
> thank's in advance.

How about:

GraphicalViewer viewer = getGraphicalViewer....
EditPart editPart =
(EditPart)viewer.getEditPartRegistry().get(yourDomainModelOb ject);
if(editPart != null) {
viewer.setSelection(new StructuredSelection(editPart));
}
Re: select an editpart from the outline? [message #529038 is a reply to message #529032] Thu, 22 April 2010 17:16 Go to previous message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
this is perfect.
I was wrong because I didn't get the editparts from the map of registering editparts.
Thnaks a lot.
Previous Topic:ComboBoxPropertyDescriptor: value doesn't appear
Next Topic:Fixed Size Editor
Goto Forum:
  


Current Time: Thu Oct 23 18:11:54 GMT 2014

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

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