Mapping from key-codes to Commands? [message #155364] |
Sun, 24 October 2004 14:26  |
Eclipse User |
|
|
|
Hi,
I have a problem to understand the binding between the
key-codes and the generates Commands.
I have implement the DeleteCommand for some graphical GEF
objects, but the execute of the Command will not be called.
I don't understand the binding between key-codes and the Commands.
I can't fixe the bug without the required background.
I have insert the code for the KeyHandler via cut&paste in my Editor:
protected void configureGraphicalViewer()
{
//root editpart:
FreeformGraphicalRootEditPart root = new FreeformGraphicalRootEditPart();
getGraphicalViewer().setRootEditPart(root);
//keyhandler:
KeyHandler keyHandler = new KeyHandler();
keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0),
getActionRegistry().getAction(GEFActionConstants.DELETE));
getGraphicalViewer().setKeyHandler(new
GraphicalViewerKeyHandler(getGraphicalViewer()).setParent(ke yHandler));
}
MyDeleteCommand will be instantiated if I select the corresponding
GEF object - but if I press the DEL key nothing happens.
I have modified the "rlemaigr.classdiagrameditor.MyEditor". The DEL function of
GEF objects works fine. But I have changed some code and at the moment it is impossible
for me to fixe the error.
I NEED a background articel to understand the Action/Key/Command... handling!!!!!!!
greetings
Andreas
|
|
|
|
|
Re: Mapping from key-codes to Commands? [message #155452 is a reply to message #155394] |
Mon, 25 October 2004 05:58  |
Eclipse User |
|
|
|
Hi,
I have found the code which enables/disables my DEL-Action
If I install the "GroupComponentEditPolicy" for my Group Element
the delete of objects is now disabled.
public void <MyGroupEditPart.>createEditPolicies()
{
super.createEditPolicies();
//installEditPolicy(EditPolicy.COMPONENT_ROLE, new GroupComponentEditPolicy(){});
installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicyGroupImpl());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new GroupDirectEditPolicy());
}
Class structure:
----------------
(root element) (group container) (elements in the conainer)
MyFormEditPart -> MyGroupEditPart -> MyGroupElementEditPart
If I don't install the the COMPONENT_ROLE I can't move
the objects in the MyGroupEditPart via DragDrop and I can't select
the element in MyGroupEditPart!
Question: How to handle the parent/child structure with the delete support?
Greetings
Andreas
|
|
|
Powered by
FUDForum. Page generated in 0.05063 seconds