Index: plugin.properties =================================================================== retrieving revision 1.13 diff -u -r1.13 plugin.properties --- plugin.properties 8 Oct 2003 14:31:27 -0000 1.13 +++ plugin.properties 26 Dec 2003 03:04:48 -0000 @@ -18,4 +18,5 @@ classpathVariableInitializersName=Classpath Variable Initializers classpathContainerInitializersName=Classpath Container Initializers codeFormattersName=Source Code Formatters -javaTaskName=Java Task \ No newline at end of file +javaTaskName=Java Task +inputMatcher=Input Matcher \ No newline at end of file Index: plugin.xml =================================================================== retrieving revision 1.55 diff -u -r1.55 plugin.xml --- plugin.xml 28 Nov 2003 11:19:59 -0000 1.55 +++ plugin.xml 26 Dec 2003 03:04:49 -0000 @@ -33,6 +33,7 @@ + Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java =================================================================== retrieving revision 1.165 diff -u -r1.165 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 11 Dec 2003 15:15:25 -0000 1.165 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 26 Dec 2003 03:05:10 -0000 @@ -451,10 +451,10 @@ findTypesAndPackages(completionToken, scope); findKeywords(completionToken, singleNameReference.possibleKeywords); if(singleNameReference.canBeExplicitConstructor){ - if(CharOperation.prefixEquals(completionToken, Keywords.THIS, false)) { + if(InputMatcher.prefixEquals(completionToken, Keywords.THIS, false)) { ReferenceBinding ref = scope.enclosingSourceType(); findExplicitConstructors(Keywords.THIS, ref, (MethodScope)scope, singleNameReference); - } else if(CharOperation.prefixEquals(completionToken, Keywords.SUPER, false)) { + } else if(InputMatcher.prefixEquals(completionToken, Keywords.SUPER, false)) { ReferenceBinding ref = scope.enclosingSourceType(); findExplicitConstructors(Keywords.SUPER, ref.superclass(), (MethodScope)scope, singleNameReference); } @@ -1034,7 +1034,7 @@ return; if (token.length <= classField.length - && CharOperation.prefixEquals(token, classField, false /* ignore case */ + && InputMatcher.prefixEquals(token, classField, false /* ignore case */ )) { int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); @@ -1236,7 +1236,7 @@ if (fieldLength > field.name.length) continue next; - if (!CharOperation.prefixEquals(fieldName, field.name, false /* ignore case */)) continue next; + if (!InputMatcher.prefixEquals(fieldName, field.name, false /* ignore case */)) continue next; if (options.checkVisibility && !field.canBeSeenBy(receiverType, invocationSite, scope)) continue next; @@ -1431,7 +1431,7 @@ if (receiverType.isArrayType()) { if (token.length <= lengthField.length - && CharOperation.prefixEquals(token, lengthField, false /* ignore case */ + && InputMatcher.prefixEquals(token, lengthField, false /* ignore case */ )) { int relevance = computeBaseRelevance(); @@ -1453,7 +1453,7 @@ relevance); } if (token.length <= cloneMethod.length - && CharOperation.prefixEquals(token, cloneMethod, false /* ignore case */ + && InputMatcher.prefixEquals(token, cloneMethod, false /* ignore case */ )) { ReferenceBinding objectRef = scope.getJavaLangObject(); @@ -1552,7 +1552,7 @@ if (length > 0) for (int i = 0; i < choices.length; i++) if (length <= choices[i].length - && CharOperation.prefixEquals(keyword, choices[i], false /* ignore case */ + && InputMatcher.prefixEquals(keyword, choices[i], false /* ignore case */ )){ int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); @@ -1671,7 +1671,7 @@ if (typeLength > memberType.sourceName.length) continue next; - if (!CharOperation.prefixEquals(typeName, memberType.sourceName, false + if (!InputMatcher.prefixEquals(typeName, memberType.sourceName, false /* ignore case */ )) continue next; @@ -2034,7 +2034,7 @@ if (methodLength > method.selector.length) continue next; - if (!CharOperation.prefixEquals(methodName, method.selector, false + if (!InputMatcher.prefixEquals(methodName, method.selector, false /* ignore case */ )) continue next; @@ -2155,7 +2155,7 @@ } int computeRelevanceForCaseMatching(char[] token, char[] proposalName){ - if (CharOperation.prefixEquals(token, proposalName, true /* do not ignore case */)) { + if (InputMatcher.prefixEquals(token, proposalName, true /* do not ignore case */)) { if(CharOperation.equals(token, proposalName, true /* do not ignore case */)) { return R_CASE + R_EXACT_NAME; } else { @@ -2305,7 +2305,7 @@ if (methodLength > method.selector.length) continue next; - if (!CharOperation.prefixEquals(methodName, method.selector, false + if (!InputMatcher.prefixEquals(methodName, method.selector, false /* ignore case */ )) continue next; @@ -2650,7 +2650,7 @@ if (!localType.isAnonymousType()) { if (typeLength > localType.sourceName.length) continue next; - if (!CharOperation.prefixEquals(typeName, localType.sourceName, false + if (!InputMatcher.prefixEquals(typeName, localType.sourceName, false /* ignore case */ )) continue next; @@ -2717,7 +2717,7 @@ if (typeLength > sourceType.sourceName.length) continue; - if (!CharOperation.prefixEquals(token, sourceType.sourceName, false)) continue; + if (!InputMatcher.prefixEquals(token, sourceType.sourceName, false)) continue; int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); @@ -2851,7 +2851,7 @@ if (typeLength > qualifiedSourceTypeName.length) continue; if (!(packageBinding == sourceType.getPackage())) continue; - if (!CharOperation.prefixEquals(qualifiedName, qualifiedSourceTypeName, false)) continue; + if (!InputMatcher.prefixEquals(qualifiedName, qualifiedSourceTypeName, false)) continue; int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); @@ -2935,7 +2935,7 @@ if (tokenLength > local.name.length) continue next; - if (!CharOperation.prefixEquals(token, local.name, false /* ignore case */ + if (!InputMatcher.prefixEquals(token, local.name, false /* ignore case */ )) continue next; @@ -3074,7 +3074,7 @@ accept(name, 0); } void accept(char[] name, int prefixAndSuffixRelevance){ - if (CharOperation.prefixEquals(t, name, false)) { + if (InputMatcher.prefixEquals(t, name, false)) { int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); relevance += computeRelevanceForCaseMatching(t, name); Index: codeassist/org/eclipse/jdt/internal/codeassist/IInputMatcher.java =================================================================== RCS file: codeassist/org/eclipse/jdt/internal/codeassist/IInputMatcher.java diff -N codeassist/org/eclipse/jdt/internal/codeassist/IInputMatcher.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ codeassist/org/eclipse/jdt/internal/codeassist/IInputMatcher.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +package org.eclipse.jdt.internal.codeassist; + +public interface IInputMatcher { + boolean inputMatches( + char[] input, + char[] name, + boolean isCaseSensitive); +} Index: codeassist/org/eclipse/jdt/internal/codeassist/InputMatcher.java =================================================================== RCS file: codeassist/org/eclipse/jdt/internal/codeassist/InputMatcher.java diff -N codeassist/org/eclipse/jdt/internal/codeassist/InputMatcher.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ codeassist/org/eclipse/jdt/internal/codeassist/InputMatcher.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,84 @@ +package org.eclipse.jdt.internal.codeassist; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.core.JavaCore; +import java.util.ArrayList; + +public class InputMatcher implements IInputMatcher { + IInputMatcher[] matcherPlugins; + static InputMatcher plugin = new InputMatcher(); + public InputMatcher() { + init(); + } + + private void init() { + plugin = this; + try { + matcherPlugins = instantiateMatchers(); + } catch (CoreException ex) { + if (JavaModelManager.CP_RESOLVE_VERBOSE) { + ex.printStackTrace(); + } + } + } + + protected IInputMatcher[] instantiateMatchers() throws CoreException { + IExtensionPoint extension = + JavaCore.getPlugin().getDescriptor().getExtensionPoint( + "inputMatcher"); + ArrayList list = new ArrayList(); + list.add(extension); + list.remove(0); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + if (extensions == null || extensions.length == 0) + return null; + for (int i = 0; i < extensions.length; i++) { + IConfigurationElement[] configElements = + extensions[i].getConfigurationElements(); + for (int j = 0; j < configElements.length; j++) { + try { + Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ + if (execExt instanceof IInputMatcher) { + list.add(execExt); + } + } catch (CoreException e) { + if (JavaModelManager.CP_RESOLVE_VERBOSE) { + e.printStackTrace(); + } + } + } + } + } + + IInputMatcher[] ret = new IInputMatcher[list.size()]; + System.arraycopy(list.toArray(), 0, ret, 0, list.size()); + return ret; + } + public boolean inputMatches( + char[] input, + char[] name, + boolean isCaseSensitive) { + if (matcherPlugins == null || matcherPlugins.length == 0) + return CharOperation.prefixEquals(input, name, isCaseSensitive); + + for (int i = 0; i < matcherPlugins.length; i++) { + if (matcherPlugins[i].inputMatches(input, name, isCaseSensitive)) { + return true; + } + } + return false; + } + public synchronized static boolean prefixEquals( + char[] input, + char[] name, + boolean isCaseSensitive) { + return plugin.inputMatches(input, name, isCaseSensitive); + } + +} Index: codeassist/org/eclipse/jdt/internal/codeassist/InputMatcherPlugin.java =================================================================== RCS file: codeassist/org/eclipse/jdt/internal/codeassist/InputMatcherPlugin.java diff -N codeassist/org/eclipse/jdt/internal/codeassist/InputMatcherPlugin.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ codeassist/org/eclipse/jdt/internal/codeassist/InputMatcherPlugin.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +package org.eclipse.jdt.internal.codeassist; + +public interface InputMatcherPlugin { + public abstract boolean inputMatched( + char[] input, + char[] name, + boolean isCaseSensitive); +} Index: schema/inputMatcher.exsd =================================================================== RCS file: schema/inputMatcher.exsd diff -N schema/inputMatcher.exsd --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ schema/inputMatcher.exsd 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,117 @@ + + + + + + + + + This extension point allows clients to contribute input matchers, + which are used to check if input matches the proposals. + + + + + + + + + + + + a fully qualified identifier of the target extension point + + + + + + + an optional identifier of the extension instance + + + + + + + an optional name of the extension instance + + + + + + + + + + + + a name identifying all input matchers. + + + + + + + the class that implements this input matcher. + This class must implement a public interface of <code>org.eclipse.jdt.internal.codeassist.IInputMatcher</code> with a public 0-argument constructor. + + + + + + + + + + + + 3.0 + + + + + + + + + Example of a declaration of a <code>inputMatcher</code> : <pre> +<extension point="org.eclipse.jdt.core.inputMatcher"> <inputMatcher id="Abbrev" + class="com.example.MyInputMatcher"/> +</extension> +</pre> + + + + + + + + + + + + + + + + + + + + + + + + + + + <p> +<a href="hglegal.htm"> + <img SRC="ngibmcpy.gif" + ALT="Copyleft" + BORDER=0 height=14 width=324></a> +</p> + + + +