Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » setting the focus on a Figure
setting the focus on a Figure [message #242213] Tue, 08 April 2008 03:26 Go to next message
Eclipse User
Originally posted by: alexjaquet.gmail.com

Hi,

My selection of the right edit part work but what is missing actually
is the selection of the figure of the edit part

anybody have the trick

Thx

Alexandre
Re: setting the focus on a Figure [message #242234 is a reply to message #242213] Tue, 08 April 2008 11:29 Go to previous messageGo to next message
Eclipse User
Originally posted by: shady_86.sify.com

you mean that an edit part which can be ellipse or any polygon?

thats an interesting idea and should be introduced in the future releases of GEF..,
Re: setting the focus on a Figure [message #242265 is a reply to message #242234] Wed, 09 April 2008 02:57 Go to previous message
Eclipse User
Originally posted by: alexjaquet.gmail.com

sharad a écrit :
> you mean that an edit part which can be ellipse or any polygon?
>
> thats an interesting idea and should be introduced in the future releases of GEF..,

yes, in my use case I move edit part from keyboard and I want to still
have the focus on my moved edit part so I want to have the focus on the
figure inside the edit part

I've done it by doing this

// Gets the table widget
Widget widget = getSelectedWidget().getParent().getParent();
int index = widget.getIndexOfSelectedChild();

Widget child = widget.getContents().get(index);
execute(new MoveWidgetAndKeepSelectionCommand(getText(), widget, child,
index + 1));

EditPart rep = viewer.getRootEditPart();
String id = getID(child);
List result = new ArrayList();
findEditPartsForElement(rep, id, result);
viewer.deselectAll();
if (result.size() == 1) {
WidgetEditPart ep = (WidgetEditPart) result.get(0);
ep = (WidgetEditPart) ep.getChildren().get(0);
ep.setSelected(EditPart.SELECTED_PRIMARY);
ep.setFocus(true);
viewer.setFocus(ep);
viewer.select(ep);
viewer.setSelection(new StructuredSelection(ep));
Previous Topic:Showing connections in Outline View
Next Topic:KeyHandler doesn't retrieve an enabled action
Goto Forum:
  


Current Time: Tue Jul 22 11:44:45 EDT 2014

Powered by FUDForum. Page generated in 0.01695 seconds