Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366150

Summary: Cannot open autocomplete popup of ContentProposalAdapter with Ctrl+Space
Product: [RT] RAP Reporter: Angelo ZERR <azerr>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tbuschto
Version: 1.5   
Target Milestone: 1.5 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 330461    

Description Angelo ZERR CLA 2011-12-09 03:56:54 EST
Hi,

I have written already the problem at http://www.eclipse.org/forums/index.php/t/263057/

I'm managing autocomple text assist with RAP 1.5 with ContentProposalAdapter, it works well except that I cannot open the popup with Ctrl+Space. I have debugged RAP code and the when I do Ctrl+Space I go at ActiveKeysUtil#processEvent :

--------------------------------------------------------
private static void processEvent( Display display, Event event ) {
    IFilterEntry[] filters = getFilterEntries( display );
    for( int i = 0; i < filters.length; i++ ) {
      if( filters[ i ].getType() == event.type ) {
        filters[ i ].getListener().handleEvent( event );
      }
    }
  }

  private static IFilterEntry[] getFilterEntries( Display display ) {
    IDisplayAdapter adapter = display.getAdapter( IDisplayAdapter.class );
    return adapter.getFilters();
  }
--------------------------------------------------------

There is not filter for my autocomplete. So I have getted the ControlListener added by ContentProposalAdapter to my SWT Text firstNameText and add this listner to the Display.getCurrent() like this :

--------------------------------------------------------
Listener l =firstNameText.getListeners(SWT.KeyDown)[0];
Display.getCurrent().addFilter(SWT.KeyDown, l);
firstNameText.addDisposeListener(new DisposeListener() {
				
  public void widgetDisposed(DisposeEvent event) {
	Listener l =firstNameText.getListeners(SWT.KeyDown)[0];
	Display.getCurrent().removeFilter(SWT.KeyDown, l);
  }
});
--------------------------------------------------------

If it's right way, I think this code shoulb be done in the ContentProposalAdapter class.

Regards Angelo
Comment 1 Ivan Furnadjiev CLA 2011-12-09 05:03:44 EST
The activation of the proposals popup with a keystroke combination ( KeyStroke.getInstance( "CTRL+c" ) in your case) is handled in ContentProposalAdapter#controlListener. Due to some limitations/issues with the client-side key event handling (SyncKeyEventUtil/AsyncKeyEventUtil), combinations with CTRL does not work in Firefox. In other browsers I found that the keyCode/charCode is wrong when modifier is used. Please note that the current key events implementation was created to serve the cell editors needs (Bug 225764) and has some limitations for using it for a generic purpose.
Comment 2 Tim Buschtoens CLA 2012-01-12 05:49:23 EST
The key events have been refactored, this should work now. Can someone confirm this?
Comment 3 Ivan Furnadjiev CLA 2012-01-25 08:26:04 EST
Fixed by enable the corresponding key events code in the ContentProposalAdapter class.