if (templateName.startsWith(content, 1)) { valid= true; } else if (isSubstringEnabled && CharOperation.substringMatch(content.indexOf('<') == 0 ? content.substring(1) : content, templateName.substring(1))) { valid= true; fIsSubstringMatch= true;
/** * Checks whether name matches the token according to the current * code completion settings (substring match, camel case match etc.) * and sets whether the current match is a suffix proposal. * * @param token the token that is tested * @param name the name to match * @return <code>true</code> if the token does not match, * <code>false</code> otherwise */ private boolean isFailedMatch(char[] token, char[] name) { if ((this.options.substringMatch && CharOperation.substringMatch(token, name)) || (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, name)) || CharOperation.prefixEquals(token, name, false)) { return false; } return true; } private boolean isForbidden(ReferenceBinding binding) {
/** * Checks whether name matches the token according to the current * code completion settings (substring match, camel case match etc.) * and sets whether the current match is a suffix proposal. * * @param token the token that is tested * @param name the name to match * @return <code>true</code> if the token does not match, * <code>false</code> otherwise */ private boolean isFailedMatch(char[] token, char[] name) { if ((this.options.substringMatch && CharOperation.substringMatch(token, name)) || (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, name)) || CharOperation.prefixEquals(token, name, false)) { return false; } return true; } private boolean isForbidden(ReferenceBinding binding) {
/** * Checks whether name matches the token according to the current * code completion settings (substring match, camel case match etc.) * and sets whether the current match is a suffix proposal. * * @param token the token that is tested * @param name the name to match * @return <code>true</code> if the token does not match, * <code>false</code> otherwise */ private boolean isFailedMatch(char[] token, char[] name) { if ((this.options.substringMatch && CharOperation.substringMatch(token, name)) || (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, name)) || CharOperation.prefixEquals(token, name, false)) { return false; } return true; } private boolean isForbidden(ReferenceBinding binding) {
if (templateName.startsWith(content, 1)) { valid= true; } else if (isSubstringEnabled && CharOperation.substringMatch(content.indexOf('<') == 0 ? content.substring(1) : content, templateName.substring(1))) { valid= true; fIsSubstringMatch= true;
/** * Matches the given <code>pattern</code> in <code>string</code> and returns the match rule. * * @param pattern the pattern to match * @param string the string to look for the pattern * @return the match rule used to match the given <code>pattern</code> in <code>string</code>, * or -1 if the <code>pattern</code> doesn't match the <code>string</code> based on any * rule * @since 3.12 */ protected int getPatternMatchRule(String pattern, String string) { String start; try { start= string.substring(0, pattern.length()); } catch (StringIndexOutOfBoundsException e) { String message= "Error retrieving proposal text.\nDisplay string:\n" + string + "\nPattern:\n" + pattern; //$NON-NLS-1$//$NON-NLS-2$ JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, message, e)); return -1; } if (start.equalsIgnoreCase(pattern)) { return SearchPattern.R_PREFIX_MATCH; } else if (isCamelCaseMatching() && CharOperation.camelCaseMatch(pattern.toCharArray(), string.toCharArray())) { return SearchPattern.R_CAMELCASE_MATCH; } else if (isSubstringMatching() && CharOperation.substringMatch(pattern.toCharArray(), string.toCharArray())) { return SearchPattern.R_SUBSTRING_MATCH; } else { return -1; } }
/** * Matches the given <code>pattern</code> in <code>string</code> and returns the match rule. * * @param pattern the pattern to match * @param string the string to look for the pattern * @return the match rule used to match the given <code>pattern</code> in <code>string</code>, * or -1 if the <code>pattern</code> doesn't match the <code>string</code> based on any * rule * @since 3.12 */ protected int getPatternMatchRule(String pattern, String string) { String start; try { start= string.substring(0, pattern.length()); } catch (StringIndexOutOfBoundsException e) { String message= "Error retrieving proposal text.\nDisplay string:\n" + string + "\nPattern:\n" + pattern; //$NON-NLS-1$//$NON-NLS-2$ JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, message, e)); return -1; } if (start.equalsIgnoreCase(pattern)) { return SearchPattern.R_PREFIX_MATCH; } else if (isCamelCaseMatching() && CharOperation.camelCaseMatch(pattern.toCharArray(), string.toCharArray())) { return SearchPattern.R_CAMELCASE_MATCH; } else if (isSubstringMatching() && CharOperation.substringMatch(pattern.toCharArray(), string.toCharArray())) { return SearchPattern.R_SUBSTRING_MATCH; } else { return -1; } }
int computeRelevanceForCaseMatching(char[] token, char[] proposalName){ if(CharOperation.equals(token, proposalName, true)) { return R_EXACT_NAME + R_CASE; } else if(CharOperation.equals(token, proposalName, false)) { return R_EXACT_NAME; } else if (CharOperation.prefixEquals(token, proposalName, false)) { if (CharOperation.prefixEquals(token, proposalName, true)) return R_CASE; } else if (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, proposalName)){ return R_CAMEL_CASE; } else if (this.options.substringMatch && CharOperation.substringMatch(token, proposalName)) { return R_SUBSTRING; } return 0; }
int computeRelevanceForCaseMatching(char[] token, char[] proposalName){ if(CharOperation.equals(token, proposalName, true)) { return R_EXACT_NAME + R_CASE; } else if(CharOperation.equals(token, proposalName, false)) { return R_EXACT_NAME; } else if (CharOperation.prefixEquals(token, proposalName, false)) { if (CharOperation.prefixEquals(token, proposalName, true)) return R_CASE; } else if (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, proposalName)){ return R_CAMEL_CASE; } else if (this.options.substringMatch && CharOperation.substringMatch(token, proposalName)) { return R_SUBSTRING; } return 0; }
int computeRelevanceForCaseMatching(char[] token, char[] proposalName){ if(CharOperation.equals(token, proposalName, true)) { return R_EXACT_NAME + R_CASE; } else if(CharOperation.equals(token, proposalName, false)) { return R_EXACT_NAME; } else if (CharOperation.prefixEquals(token, proposalName, false)) { if (CharOperation.prefixEquals(token, proposalName, true)) return R_CASE; } else if (this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, proposalName)){ return R_CAMEL_CASE; } else if (this.options.substringMatch && CharOperation.substringMatch(token, proposalName)) { return R_SUBSTRING; } return 0; }
if (JavaCore.ENABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_SUBSTRING_MATCH)) && CharOperation.substringMatch(pattern, displayString)) { matchRule= SearchPattern.R_SUBSTRING_MATCH;
if (JavaCore.ENABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_SUBSTRING_MATCH)) && CharOperation.substringMatch(pattern, displayString)) { matchRule= SearchPattern.R_SUBSTRING_MATCH;
for (int i = 0; i < choices.length; i++) if (length <= choices[i].length && (CharOperation.prefixEquals(keyword, choices[i], false /* ignore case */) || (this.options.substringMatch && CharOperation.substringMatch(keyword, choices[i])))) { if (ignorePackageKeyword && CharOperation.equals(choices[i], Keywords.PACKAGE)) continue;
for (int i = 0; i < choices.length; i++) if (length <= choices[i].length && (CharOperation.prefixEquals(keyword, choices[i], false /* ignore case */) || (this.options.substringMatch && CharOperation.substringMatch(keyword, choices[i])))) { if (ignorePackageKeyword && CharOperation.equals(choices[i], Keywords.PACKAGE)) continue;
for (int i = 0; i < choices.length; i++) if (length <= choices[i].length && (CharOperation.prefixEquals(keyword, choices[i], false /* ignore case */) || (this.options.substringMatch && CharOperation.substringMatch(keyword, choices[i])))) { if (ignorePackageKeyword && CharOperation.equals(choices[i], Keywords.PACKAGE)) continue;