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

Bug 316745

Summary: [content assist] ICompletionListener is not informed about mouse selection changes
Product: [Eclipse Project] Platform Reporter: Christian Georgi <christian.georgi>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, klaus.steinbach, remy.suen
Version: 3.5.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Christian Georgi CLA 2010-06-14 07:09:00 EDT
Build Identifier: 3.5.2

org.eclipse.jface.text.contentassist.ICompletionListener.selectionChanged() is called whenever the user presses a key which causes a selection change, however, it is not called when the same is done using the mouse.  Expectation is that selectionChanged() abstracts from the concrete input device (like in any SWT selection change event).

We use the selectionChanged notification to get the currently selected proposal.  What we actually want to have is a additional shortcut, e.g. Shift+Enter/double-click to insert the selection proposal in a different way.  Do you have any ideas on how to achieve this?

Reproducible: Always
Comment 1 Remy Suen CLA 2010-06-14 07:26:32 EDT
JFace Text code is owned by the Text component.
Comment 2 Dani Megert CLA 2010-06-14 08:32:34 EDT
>What we actually want to have is a additional shortcut, e.g.
>Shift+Enter/double-click to insert the selection proposal in a different way. 
>Do you have any ideas on how to achieve this?
I see two things you could try:
1. Register a display filter (Display.addFilter(*)) and remember when your key
   binding is pressed. In ICompletionProposal.apply(*) check the remembered
   state.
2. Define a command that's always available and register your key binding for 
   it. Then add a command listener that detects when the command got executed.
   Alternatively you could register an empty action for that command that just
   remembers the execution.  In ICompletionProposal.apply(*) check the 
   remembered state.

For both solutions you should reset the state in ICompletionListener.assistSessionStarted(*).

*** This bug has been marked as a duplicate of bug 272284 ***