Bug 25684

Summary: SelectionEngine to be made API?
Product: [Eclipse Project] JDT Reporter: Claude Knaus <Claude_Knaus>
Component: CoreAssignee: David Audel <david_audel>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: All   
Whiteboard:

Description Claude Knaus CLA 2002-11-04 06:57:12 EST
To implement the browser-line navigation feature (press Ctrl and hover over a 
declaration - in HEAD), I need the SelectionEngine.checkSelection() 
functionality. My workaround so far was to use the code from double click 
strategy to highlight the text corresponding to the declaration. I was 
wondering if there were plans to make this class and method API.
Comment 1 Philipe Mulet CLA 2002-11-04 09:06:11 EST
Not currently. 
Comment 2 Philipe Mulet CLA 2002-11-05 06:58:25 EST
Could be promoted to CharOperation...

David, what do you think ?
Comment 3 David Audel CLA 2002-11-07 06:40:39 EST
checkSelection() can not be easily promoted to CharOperation because this 
method change the value of several fields of SelectionEngine.
- int actualSelectionStart
- int actualSelectionEnd
- char[] selectedIdentifier
- char[] qualifiedSelection
Comment 4 David Audel CLA 2002-11-07 06:44:10 EST
Claude, you can easily create your own method.
Use 'org.eclipse.jdt.core.ToolFactory#createScanner()' and copy the algorithm 
of 'SelectionEngine#checkSelection()' (replace 'Scanner' by 'IScanner' 
and 'scanner.startPosition' by 'scanner.getCurrentTokenStartPosition()' 
and 'scanner.currentPosition' by 'scanner.getCurrentTokenEndPosition() + 1').
Comment 5 Claude Knaus CLA 2002-11-07 10:21:44 EST
Well, I rather stick to the double click strategy for now. I don't feel like 
duplicating that much code.
Comment 6 David Audel CLA 2002-11-18 06:09:28 EST
checkSelection can not be promoted to API.

Closing.