KickJava   Java API By Example, From Geeks To Geeks.

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


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 /*
14  * Completion node build by the parser in any case it was intending to
15  * reduce an package statement containing the cursor location.
16  * e.g.
17  *
18  * package java.io[cursor];
19  * class X {
20  * void foo() {
21  * }
22  * }
23  *
24  * ---> <CompleteOnPackage:java.io>
25  * class X {
26  * void foo() {
27  * }
28  * }
29  *
30  * The source range is always of length 0.
31  * The arguments of the allocation expression are all the arguments defined
32  * before the cursor.
33  */

34  
35 import org.eclipse.jdt.internal.compiler.ast.*;
36 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
37
38 public class CompletionOnPackageReference extends ImportReference {
39 public CompletionOnPackageReference(char[][] tokens , long[] positions) {
40     super(tokens, positions, true, ClassFileConstants.AccDefault);
41 }
42 public StringBuffer JavaDoc print(int indent, StringBuffer JavaDoc output, boolean withOnDemand) {
43     
44     printIndent(indent, output).append("<CompleteOnPackage:"); //$NON-NLS-1$
45
for (int i = 0; i < tokens.length; i++) {
46         if (i > 0) output.append('.');
47         output.append(tokens[i]);
48     }
49     return output.append('>');
50 }
51 }
52
Popular Tags