KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > codeassist > complete > CompletionOnKeyword1


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.codeassist.complete;
12
13 import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
14 import org.eclipse.jdt.internal.compiler.lookup.Scope;
15 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
16
17 public class CompletionOnKeyword1 extends SingleTypeReference implements CompletionOnKeyword {
18     private char[][] possibleKeywords;
19     public boolean canCompleteEmptyToken;
20     
21     public CompletionOnKeyword1(char[] token, long pos, char[] possibleKeyword) {
22         this(token, pos, new char[][]{possibleKeyword});
23     }
24     public CompletionOnKeyword1(char[] token, long pos, char[][] possibleKeywords) {
25         super(token, pos);
26         this.possibleKeywords = possibleKeywords;
27     }
28     public boolean canCompleteEmptyToken() {
29         return this.canCompleteEmptyToken;
30     }
31     public char[] getToken() {
32         return token;
33     }
34     public char[][] getPossibleKeywords() {
35         return possibleKeywords;
36     }
37     public void aboutToResolve(Scope scope) {
38         getTypeBinding(scope);
39     }
40     protected TypeBinding getTypeBinding(Scope scope) {
41         throw new CompletionNodeFound(this, scope);
42     }
43     public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output){
44         
45         return output.append("<CompleteOnKeyword:").append(token).append('>'); //$NON-NLS-1$
46
}
47 }
48
Popular Tags