01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.codeassist.complete;
11:
12: /*
13: * Completion node build by the parser in any case it was intending to
14: * reduce an package statement containing the cursor location.
15: * e.g.
16: *
17: * package java.io[cursor];
18: * class X {
19: * void foo() {
20: * }
21: * }
22: *
23: * ---> <CompleteOnPackage:java.io>
24: * class X {
25: * void foo() {
26: * }
27: * }
28: *
29: * The source range is always of length 0.
30: * The arguments of the allocation expression are all the arguments defined
31: * before the cursor.
32: */
33:
34: import org.eclipse.jdt.internal.compiler.ast.*;
35: import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
36:
37: public class CompletionOnPackageReference extends ImportReference {
38: public CompletionOnPackageReference(char[][] tokens,
39: long[] positions) {
40: super (tokens, positions, true, ClassFileConstants.AccDefault);
41: }
42:
43: public StringBuffer print(int indent, StringBuffer output,
44: boolean withOnDemand) {
45:
46: printIndent(indent, output).append("<CompleteOnPackage:"); //$NON-NLS-1$
47: for (int i = 0; i < tokens.length; i++) {
48: if (i > 0)
49: output.append('.');
50: output.append(tokens[i]);
51: }
52: return output.append('>');
53: }
54: }
|