Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » force the selection of an edit part on move
force the selection of an edit part on move [message #242181] Fri, 04 April 2008 06:32 Go to next message
Eclipse User
Originally posted by: alexjaquet.gmail.com

Hi,

I've implemented a functionality that allow an user to move an edit part
inside a container by using the arrow keys and now I need to not
deselect the edit part that have been moved (I have to reselect the edit
part to move it again)

Any hints to do that

Thanks
Re: force the selection of an edit part on move [message #242184 is a reply to message #242181] Fri, 04 April 2008 08:06 Go to previous messageGo to next message
Eclipse User
Originally posted by: alexjaquet.gmail.com

for testing purpose I've overriden the method removeNotify of the
AbstractEditPart and force the viewer to not deselect the current edit part

but it doesn't work ...

Any idea welcomed

Thanks in advance

Alexandre
Re: force the selection of an edit part on move [message #242195 is a reply to message #242184] Fri, 04 April 2008 11:34 Go to previous messageGo to next message
Eclipse User
Originally posted by: alexjaquet.gmail.com

In the GEF documentation it's written

Closely related to selection is focus. Focus is a single editpart
maintained by the EditPartViewer. Focus is used when manipulating
selection via keyboard. By moving focus, the user can navigate from one
editpart to another without changing the current selection. The user can
add/remove the focused editpart from the selection. If focus is not
explicitly set, it is the same as the primary selected part.

In my drag edit part I added a viewer.setFocus(selectedEditPart) but the
method getFocusEditPart() is never called
Re: force the selection of an edit part on move [message #242200 is a reply to message #242195] Mon, 07 April 2008 06:49 Go to previous messageGo to next message
Eclipse User
Originally posted by: alexjaquet.gmail.com

Still nobody have an idea ?

thanks ...
Re: force the selection of an edit part on move [message #242204 is a reply to message #242200] Mon, 07 April 2008 08:56 Go to previous message
Eclipse User
Originally posted by: alexjaquet.gmail.com

I've tryed to set the focus and the selected value in the drag edit part

like this

chep.setSelected(EditPart.SELECTED_PRIMARY);
viewer.setFocus(chep);

and I see at debug time than the AbstractEditPart setSelected method was
called by the notifyChanged method

so I added the following code to ensure the selected edit part is setted
correctly

//test code
if (notification.getEventType() == 1) {
WidgetEditPart editPart = this;
if (editPart.getFigure().getChildren().size() > 0) {
if (editPart.getFigure().getChildren().get(0) instanceof ColumnHeader) {
EditPart columnHeaderEditPart = (EditPart)
editPart.getChildren().get(0);
columnHeaderEditPart.setSelected(EditPart.SELECTED_PRIMARY);
getViewer().setFocus(columnHeaderEditPart);
}
}
}
but is still doesn't select the edit part
Previous Topic:Incorrect print results
Next Topic:How to make a tree viewer in GEF.
Goto Forum:
  


Current Time: Tue Oct 21 21:33:13 GMT 2014

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

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