setting the focus on a Figure [message #242213] |
Tue, 08 April 2008 07:26 |
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 #242265 is a reply to message #242234] |
Wed, 09 April 2008 06:57 |
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));
|
|
|
Powered by
FUDForum. Page generated in 0.02873 seconds