* @param additionalInfo the additional information
*/
private void addBracketProposal(String proposal, int cursorPosition, String displayString, String additionalInfo) {
String prolog= fExpression.substring(0, fDocumentOffset);
if (! fIsEscape && prolog.endsWith("\\") && proposal.startsWith("\\")) { //$NON-NLS-1$//$NON-NLS-2$
fProposals.add(new ContentProposal(proposal, displayString, additionalInfo, cursorPosition));
return;
}
for (int i= 1; i <= cursorPosition; i++) {
String prefix= proposal.substring(0, i);
if (prolog.endsWith(prefix)) {
String postfix= proposal.substring(cursorPosition);
String epilog= fExpression.substring(fDocumentOffset);
if (epilog.startsWith(postfix)) {
fPriorityProposals.add(new ContentProposal(proposal.substring(i, cursorPosition), displayString, additionalInfo, cursorPosition-i));
} else {
fPriorityProposals.add(new ContentProposal(proposal.substring(i), displayString, additionalInfo, cursorPosition-i));
}
return;
}
}
fProposals.add(new ContentProposal(proposal, displayString, additionalInfo, cursorPosition));
}