Home » Eclipse Projects » GEF » How to delete a figure?
| |
Re: How to delete a figure? [message #9249 is a reply to message #8758] |
Mon, 10 June 2002 13:56 |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
> menu opens the delete action apears there, but it is disabled. moreover,
> when i press the DEL key after i select an editpart nothing happends. do
You shouldn't add any key listeners like this. The reason is that you will
be able to delete an object while it is being dragged. In general,
everything should be "locked" during a drag, such as Undo, Redo, Delete. No
menu accelerators function during a drag, so we're safe there. But the
canvas still gets key events.
To get this for *free*, create a GraphicalViewerKeyHandler for your
GraphicalViewer. Then, do a:
sharedKeyHandler.put(
KeyStroke.getPressed(SWT.DEL, 0),
getActionRegistry().getAction(DeleteAction.ID));
KeyHandler's will only get KeyEvents at the appropriate time. In this case,
the SelectionTool will forward the key's for you.
You can also create a common keyhandler to be used by more than one
EditPartViewer, and then 1 or more specific handler customized for each
viewer. User KeyHandler.setNext() to delegate to the common one.
|
|
|
Re: How to delete a figure? [message #9362 is a reply to message #9249] |
Mon, 10 June 2002 15:04 |
Yoav Rubin Messages: 93 Registered: July 2009 |
Member |
|
|
Hi
what is KeyHandler, or GraphicalViewerKeyHandler for that matter. i can\'t
find any reference for it in the documentation of gef.
thanks
yoav
Randy Hudson wrote:
> > menu opens the delete action apears there, but it is disabled. moreover,
> > when i press the DEL key after i select an editpart nothing happends. do
> You shouldn\'t add any key listeners like this. The reason is that you will
> be able to delete an object while it is being dragged. In general,
> everything should be \"locked\" during a drag, such as Undo, Redo, Delete.
No
> menu accelerators function during a drag, so we\'re safe there. But the
> canvas still gets key events.
> To get this for *free*, create a GraphicalViewerKeyHandler for your
> GraphicalViewer. Then, do a:
> sharedKeyHandler.put(
> KeyStroke.getPressed(SWT.DEL, 0),
> getActionRegistry().getAction(DeleteAction.ID));
> KeyHandler\'s will only get KeyEvents at the appropriate time. In this case,
> the SelectionTool will forward the key\'s for you.
> You can also create a common keyhandler to be used by more than one
> EditPartViewer, and then 1 or more specific handler customized for each
> viewer. User KeyHandler.setNext() to delegate to the common one.
|
|
|
Re: How to delete a figure? [message #9409 is a reply to message #9362] |
Mon, 10 June 2002 17:19 |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
It is new and undocumented.
See its usage in LogicEditor.
"Yoav Rubin" <yoav@il.ibm.com> wrote in message
news:ae2f6e$4ej$1@rogue.oti.com...
> Hi
> what is KeyHandler, or GraphicalViewerKeyHandler for that matter. i can\'t
> find any reference for it in the documentation of gef.
> thanks
> yoav
>
> Randy Hudson wrote:
>
> > > menu opens the delete action apears there, but it is disabled.
moreover,
> > > when i press the DEL key after i select an editpart nothing happends.
do
>
> > You shouldn\'t add any key listeners like this. The reason is that you
will
> > be able to delete an object while it is being dragged. In general,
> > everything should be \"locked\" during a drag, such as Undo, Redo,
Delete.
> No
> > menu accelerators function during a drag, so we\'re safe there. But the
> > canvas still gets key events.
>
> > To get this for *free*, create a GraphicalViewerKeyHandler for your
> > GraphicalViewer. Then, do a:
> > sharedKeyHandler.put(
> > KeyStroke.getPressed(SWT.DEL, 0),
> > getActionRegistry().getAction(DeleteAction.ID));
>
> > KeyHandler\'s will only get KeyEvents at the appropriate time. In this
case,
> > the SelectionTool will forward the key\'s for you.
>
>
>
> > You can also create a common keyhandler to be used by more than one
> > EditPartViewer, and then 1 or more specific handler customized for each
> > viewer. User KeyHandler.setNext() to delegate to the common one.
>
>
>
>
>
|
|
|
Goto Forum:
Current Time: Sat Nov 09 02:13:57 GMT 2024
Powered by FUDForum. Page generated in 0.03445 seconds
|