Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Handle delete key in RCP application using GEF
Handle delete key in RCP application using GEF [message #192840] Tue, 23 August 2005 03:24 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:Curriculum Vitae
Next Topic:GEF infrastructure in Views instead of Editors
Goto Forum:
  


Current Time: Fri Apr 26 08:14:24 GMT 2024

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

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

Back to the top