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: import org.eclipse.jdt.core.compiler.CharOperation;
13: import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
14: import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
15:
16: public class CompletionOnFieldName extends FieldDeclaration {
17: private static final char[] FAKENAMESUFFIX = " ".toCharArray(); //$NON-NLS-1$
18: public char[] realName;
19:
20: public CompletionOnFieldName(char[] name, int sourceStart,
21: int sourceEnd) {
22: super (CharOperation.concat(name, FAKENAMESUFFIX), sourceStart,
23: sourceEnd);
24: this .realName = name;
25: }
26:
27: public StringBuffer printStatement(int tab, StringBuffer output) {
28:
29: printIndent(tab, output).append("<CompleteOnFieldName:"); //$NON-NLS-1$
30: if (type != null)
31: type.print(0, output).append(' ');
32: output.append(realName);
33: if (initialization != null) {
34: output.append(" = "); //$NON-NLS-1$
35: initialization.printExpression(0, output);
36: }
37: return output.append(">;"); //$NON-NLS-1$
38: }
39:
40: public void resolve(MethodScope initializationScope) {
41: super .resolve(initializationScope);
42:
43: throw new CompletionNodeFound(this, initializationScope);
44: }
45: }
|