Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to select a shape programmatically?
How to select a shape programmatically? [message #225638] Mon, 13 April 2009 12:07 Go to next message
Eclipse UserFriend
Originally posted by: cayla_sha.gmx.net

Hello!

You all know how to select a shape with the mouse: click on it in the
diagram and then it has this black border around.
Now I want to do the same in my program-code. How can I do it?

Best wishes
Julia
Re: How to select a shape programmatically? [message #225668 is a reply to message #225638] Mon, 13 April 2009 14:12 Go to previous messageGo to next message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
Hi,
If you have editpart and would like to focus on editor.

Steps
1 . EditPart editPart obtain the graphical viewer
IDiagramGraphicalViewer viewer = editPart .getViewer();

2 .
viewer.reveal(parenteditPart);//this reveals the editpart in the viewer

viewer.setSelection(new StructuredSelection(parenteditPart));
//this sets the selection on the editpart

Regards
Byre
Re: How to select a shape programmatically? [message #225700 is a reply to message #225668] Mon, 13 April 2009 17:30 Go to previous message
Eclipse UserFriend
Originally posted by: cayla_sha.gmx.net

Thanks a lot! :)

The only thing, what I needed to call additionally, was
viewer.getControl().setFocus();

And to make it a bit saver, I call at the end:
viewer.flush();

Byre schrieb:
> Hi,
> If you have editpart and would like to focus on editor.
>
> Steps
> 1 . EditPart editPart obtain the graphical viewer
> IDiagramGraphicalViewer viewer = editPart .getViewer();
>
> 2 . viewer.reveal(parenteditPart);//this reveals the editpart in the viewer
>
> viewer.setSelection(new StructuredSelection(parenteditPart));
> //this sets the selection on the editpart
>
> Regards
> Byre
>
>
>
Previous Topic:Re: palette using patterns
Next Topic:Animation on editparts
Goto Forum:
  


Current Time: Fri Apr 26 04:15:47 GMT 2024

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

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

Back to the top