KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > codeassist > InternalCompletionContext


1 /*******************************************************************************
2  * Copyright (c) 2005, 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;
12
13
14 /**
15  * Internal completion context
16  * @since 3.1
17  */

18 public class InternalCompletionContext {
19     protected char[][] expectedTypesSignatures;
20     protected char[][] expectedTypesKeys;
21     protected int javadoc;
22     
23     protected int offset = -1;
24     protected int tokenStart = -1;
25     protected int tokenEnd = -1;
26     protected char[] token = null;
27     protected int tokenKind;
28     
29     protected void setExpectedTypesSignatures(char[][] expectedTypesSignatures) {
30         this.expectedTypesSignatures = expectedTypesSignatures;
31     }
32     
33     protected void setExpectedTypesKeys(char[][] expectedTypesKeys) {
34         this.expectedTypesKeys = expectedTypesKeys;
35     }
36
37     protected void setJavadoc(int javadoc) {
38         this.javadoc = javadoc;
39     }
40     
41     protected void setOffset(int offset) {
42         this.offset = offset;
43     }
44     
45     protected void setTokenRange(int start, int end) {
46         this.setTokenRange(start, end, -1);
47     }
48     protected void setTokenRange(int start, int end, int endOfEmptyToken) {
49         this.tokenStart = start;
50         this.tokenEnd = endOfEmptyToken > end ? endOfEmptyToken : end;
51         
52         // Work around for bug 132558 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558).
53
// completionLocation can be -1 if the completion occur at the start of a file or
54
// the start of a code snippet but this API isn't design to support negative position.
55
if(this.tokenEnd == -1) {
56             this.tokenEnd = 0;
57         }
58     }
59     
60     protected void setToken(char[] token) {
61         this.token = token;
62     }
63     
64     protected void setTokenKind(int tokenKind) {
65         this.tokenKind = tokenKind;
66     }
67 }
68
Popular Tags