Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316745 - [content assist] ICompletionListener is not informed about mouse selection changes
Summary: [content assist] ICompletionListener is not informed about mouse selection ch...
Status: CLOSED DUPLICATE of bug 272284
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.5.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-14 07:09 EDT by Christian Georgi CLA
Modified: 2010-06-14 08:32 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***