Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » DirectEditAction.calculateEnabled selection is always empty.
DirectEditAction.calculateEnabled selection is always empty. [message #217067] Wed, 31 May 2006 20:05 Go to next message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
I am trying to hookup a keyhandler for a GraphicalEditorWithFlyoutPalette
and add DIRECT_EDIT. Is there a trick to setting the selection for the
DirectEditAction? (Note that using the mouse does work for directEdit, but
clicking F2 does not.)

Should I be setting a diferrent selectionprovider for this action ?

protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
myKeyHandler = new MyKeyHandler(viewer);
myKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0),
getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT ));
viewer.setKeyHandler(myKeyHandler);

}

protected void createActions() {
super.createActions();
DirectEditAction action = new DirectEditAction((IWorkbenchPart)this);
getActionRegistry().registerAction(action);
getSelectionActions().add(action.getId());

}
Re: DirectEditAction.calculateEnabled selection is always empty. [message #217096 is a reply to message #217067] Thu, 01 June 2006 09:06 Go to previous messageGo to next message
Ravikanth Somayaji is currently offline Ravikanth Somayaji
Messages: 39
Registered: July 2009
Location: Oxford
Member
The mouse selection does work but there, the clicks are sequenced quite weirdly, you can check the flow example to examine the mouse click sequences to identify the direct edit managers. You cud also altercate the REQ_OPEN request to incorporate the double click event for any item that does not use the REQ_OPEN req, just as follows:
/* (non-Javadoc)
* @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(or g.eclipse.gef.Request)
*/
public void performRequest(Request request) {
if (request.getType() == RequestConstants.REQ_OPEN)
performDirectEdit();
else
super.performRequest(request);

}
Re: DirectEditAction.calculateEnabled selection is always empty. [message #217322 is a reply to message #217067] Fri, 02 June 2006 16:08 Go to previous message
Eclipse User
Originally posted by: none.us.ibm.com

None of the actions in GEF update enablement automatically. They must be
told to update by the editor. This is to prevent memory leaks.

However, enablement is lazy by default for that action. That means, when you
ask it if it is enabled, it will calculate its enabled status on the fly,
instead of always trying to keep it up-to-date.

Maybe the action doesn't have a selection provider?
Previous Topic:Orthogonal Connection Router w/ Handles
Next Topic:Vertical Text (Again)
Goto Forum:
  


Current Time: Sun Oct 26 00:32:53 GMT 2014

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

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