Handle delete key in RCP application using GEF [message #192840] |
Tue, 23 August 2005 03:24 |
Eclipse User |
|
|
|
Originally posted by: htzhong.gmail.com
Hi, everyone,
I'm trying to use GEF in my RCP program. I downloaded the RCP Shape
example from
http://www.eclipse.org/articles/Article-GEF-EMF/files/shapes rcp.zip and
found that the delete key doesn't work in this RCP program, while the
delete command in the context menu works fine. The delete key works in
the standard shapes plugin example too.
I tried to add the following code in configureGraphicalViewer() but it
still doesn't work.
KeyStroke delKey;
IAction delAction;
KeyHandler keyHandler = null;
try {
delKey = KeyStroke.getPressed(SWT.DEL, SWT.NONE);
delAction = getActionRegistry().getAction(ActionFactory.DELETE.getId());
keyHandler = new GraphicalViewerKeyHandler(viewer);
keyHandler.put(delKey, delAction);
viewer.setKeyHandler(keyHandler);
} catch (Exception e) {
e.printStackTrace();
}
I set a break point at WorkBenchKeyboard::executeCommand() and found
that command.isHandled() returns false, it seems that no handler is set
for the DEL key in the RCP program. Could anyone tell me how to handle
DEL key in a GEF/RCP program?
Thanks.
Hongtao
|
|
|
Re: Handle delete key in RCP application using GEF [message #193019 is a reply to message #192840] |
Wed, 24 August 2005 04:12 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
See the thread by Cleverson Schmidt entitled "Deleting a connection" from
21st of June.
"zhongh" <htzhong@gmail.com> wrote in message
news:dee4tk$ohd$1@news.eclipse.org...
> Hi, everyone,
>
> I'm trying to use GEF in my RCP program. I downloaded the RCP Shape
> example from
> http://www.eclipse.org/articles/Article-GEF-EMF/files/shapes rcp.zip and
> found that the delete key doesn't work in this RCP program, while the
> delete command in the context menu works fine. The delete key works in
> the standard shapes plugin example too.
>
> I tried to add the following code in configureGraphicalViewer() but it
> still doesn't work.
>
> KeyStroke delKey;
> IAction delAction;
> KeyHandler keyHandler = null;
> try {
> delKey = KeyStroke.getPressed(SWT.DEL, SWT.NONE);
> delAction = getActionRegistry().getAction(ActionFactory.DELETE.getId());
> keyHandler = new GraphicalViewerKeyHandler(viewer);
> keyHandler.put(delKey, delAction);
> viewer.setKeyHandler(keyHandler);
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> I set a break point at WorkBenchKeyboard::executeCommand() and found
> that command.isHandled() returns false, it seems that no handler is set
> for the DEL key in the RCP program. Could anyone tell me how to handle
> DEL key in a GEF/RCP program?
>
> Thanks.
>
> Hongtao
|
|
|
Re: Handle delete key in RCP application using GEF [message #193026 is a reply to message #193019] |
Wed, 24 August 2005 04:12 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Sorry, that's 21st of July.
"Pratik Shah" <none@unknown.com> wrote in message
news:degs2q$6de$1@news.eclipse.org...
> See the thread by Cleverson Schmidt entitled "Deleting a connection" from
> 21st of June.
>
> "zhongh" <htzhong@gmail.com> wrote in message
> news:dee4tk$ohd$1@news.eclipse.org...
> > Hi, everyone,
> >
> > I'm trying to use GEF in my RCP program. I downloaded the RCP Shape
> > example from
> > http://www.eclipse.org/articles/Article-GEF-EMF/files/shapes rcp.zip and
> > found that the delete key doesn't work in this RCP program, while the
> > delete command in the context menu works fine. The delete key works in
> > the standard shapes plugin example too.
> >
> > I tried to add the following code in configureGraphicalViewer() but it
> > still doesn't work.
> >
> > KeyStroke delKey;
> > IAction delAction;
> > KeyHandler keyHandler = null;
> > try {
> > delKey = KeyStroke.getPressed(SWT.DEL, SWT.NONE);
> > delAction = getActionRegistry().getAction(ActionFactory.DELETE.getId());
> > keyHandler = new GraphicalViewerKeyHandler(viewer);
> > keyHandler.put(delKey, delAction);
> > viewer.setKeyHandler(keyHandler);
> > } catch (Exception e) {
> > e.printStackTrace();
> > }
> >
> > I set a break point at WorkBenchKeyboard::executeCommand() and found
> > that command.isHandled() returns false, it seems that no handler is set
> > for the DEL key in the RCP program. Could anyone tell me how to handle
> > DEL key in a GEF/RCP program?
> >
> > Thanks.
> >
> > Hongtao
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02898 seconds