KickJava   Java API By Example, From Geeks To Geeks.

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


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.core.compiler.CharOperation;
14 import org.eclipse.jdt.internal.compiler.ast.Argument;
15 import org.eclipse.jdt.internal.compiler.ast.TypeReference;
16 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
17 import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
18 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
19
20
21 public class CompletionOnArgumentName extends Argument {
22
23     private static final char[] FAKENAMESUFFIX = " ".toCharArray(); //$NON-NLS-1$
24
public char[] realName;
25     public boolean isCatchArgument = false;
26
27     public CompletionOnArgumentName(char[] name , long posNom , TypeReference tr , int modifiers){
28
29         super(CharOperation.concat(name, FAKENAMESUFFIX), posNom, tr, modifiers);
30         this.realName = name;
31     }
32     
33     public void bind(MethodScope scope, TypeBinding typeBinding, boolean used) {
34
35         super.bind(scope, typeBinding, used);
36         throw new CompletionNodeFound(this, scope);
37     }
38     
39     public StringBuffer JavaDoc print(int indent, StringBuffer JavaDoc output) {
40         
41         printIndent(indent, output);
42         output.append("<CompleteOnArgumentName:"); //$NON-NLS-1$
43
if (this.type != null) this.type.print(0, output).append(' ');
44         output.append(this.realName);
45         if (this.initialization != null) {
46             output.append(" = "); //$NON-NLS-1$
47
this.initialization.printExpression(0, output);
48         }
49         return output.append('>');
50     }
51
52     public void resolve(BlockScope scope) {
53
54         super.resolve(scope);
55         throw new CompletionNodeFound(this, scope);
56     }
57 }
58
59
Popular Tags