KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > codeassist > select > SelectionOnParameterizedQualifiedTypeReference


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.select;
12
13 import org.eclipse.jdt.core.compiler.CharOperation;
14 import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
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.ClassScope;
18 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
19
20 public class SelectionOnParameterizedQualifiedTypeReference extends ParameterizedQualifiedTypeReference {
21     public SelectionOnParameterizedQualifiedTypeReference(char[][] previousIdentifiers, char[] selectionIdentifier, TypeReference[][] typeArguments, TypeReference[] assistTypeArguments, long[] positions) {
22         super(
23             CharOperation.arrayConcat(previousIdentifiers, selectionIdentifier),
24             typeArguments,
25             0,
26             positions);
27         int length = this.typeArguments.length;
28         System.arraycopy(this.typeArguments, 0, this.typeArguments = new TypeReference[length + 1][], 0, length);
29         this.typeArguments[length] = assistTypeArguments;
30     }
31     
32     public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
33         super.resolveType(scope, checkBounds);
34         //// removed unnecessary code to solve bug 94653
35
//if(this.resolvedType != null && this.resolvedType.isRawType()) {
36
// ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());
37
// throw new SelectionNodeFound(parameterizedTypeBinding);
38
//}
39
throw new SelectionNodeFound(this.resolvedType);
40     }
41     
42     public TypeBinding resolveType(ClassScope scope) {
43         super.resolveType(scope);
44         //// removed unnecessary code to solve bug 94653
45
//if(this.resolvedType != null && this.resolvedType.isRawType()) {
46
// ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());
47
// throw new SelectionNodeFound(parameterizedTypeBinding);
48
//}
49
throw new SelectionNodeFound(this.resolvedType);
50     }
51     
52     public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output) {
53         output.append("<SelectOnType:");//$NON-NLS-1$
54
int length = tokens.length;
55         for (int i = 0; i < length; i++) {
56             if(i != 0) {
57                 output.append('.');
58             }
59             output.append(tokens[i]);
60             TypeReference[] typeArgument = typeArguments[i];
61             if (typeArgument != null) {
62                 output.append('<');
63                 int max = typeArgument.length - 1;
64                 for (int j = 0; j < max; j++) {
65                     typeArgument[j].print(0, output);
66                     output.append(", ");//$NON-NLS-1$
67
}
68                 typeArgument[max].print(0, output);
69                 output.append('>');
70             }
71             
72         }
73         output.append('>');
74         return output;
75     }
76 }
77
Popular Tags