Bug 487584 - [api] clarify ICompletionProposalExtension7#emphasizeMatch(..), avoid call to getStyledDisplayString()
Summary: [api] clarify ICompletionProposalExtension7#emphasizeMatch(..), avoid call to...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.6 M6   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on: 470203
Blocks:
  Show dependency tree
 
Reported: 2016-02-10 08:06 EST by Markus Keller CLA
Modified: 2016-04-11 07:51 EDT (History)
3 users (show)

See Also:
daniel_megert: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2016-02-10 08:06:18 EST
For completion proposals that implement all ICompletionProposalExtensions,
org.eclipse.jface.text.contentassist.CompletionProposalPopup#handleSetData(Event) currently:
- calls ICompletionProposalExtension6#getStyledDisplayString() and throws the returned value away
- calls ICompletionProposalExtension7#emphasizeMatch(..) and uses the returned StyledString

Problems:
1. getStyledDisplayString() should not be called if the result is not used
2. ICompletionProposalExtension6#getStyledDisplayString() and ICompletionProposal#getDisplayString() need to tell that ICompletionProposalExtension7 exists, and getStyledDisplayString() needs to tell that it's not used in that case
3. emphasizeMatch(..) is not a good API name. The method doesn't emphasize a match in an existing string, but it returns a new styled display string in which the matching characters should be emphasized. I see two possible solutions:
3.a) pass the result of getStyledDisplayString() as an additional parameter to emphasizeMatch(..)
3.b) rename the method to getStyledDisplayString(IDocument, int, BoldStylerProvider) or getEmphasizedStyledDisplayString(..) (though I prefer the getStyledDisplayString(..)). In this case, solutions for problems 1 and 2 need to be adjusted accordingly.
Comment 1 Eclipse Genie CLA 2016-02-22 06:49:02 EST
New Gerrit change created: https://git.eclipse.org/r/67038
Comment 2 Eclipse Genie CLA 2016-02-22 06:49:45 EST
New Gerrit change created: https://git.eclipse.org/r/67039
Comment 3 Noopur Gupta CLA 2016-02-22 06:53:57 EST
Renamed #emphasizeMatch(..) to #getStyledDisplayString(IDocument, int, BoldStylerProvider), avoided call to ICompletionProposalExtension6#getStyledDisplayString() when ICompletionProposalExtension7#getStyledDisplayString(..) is used and updated the Javadocs. 

Dani/Markus, please have a look.