KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.JavadocQualifiedTypeReference;
15
16 public class CompletionOnJavadocQualifiedTypeReference extends JavadocQualifiedTypeReference implements CompletionOnJavadoc {
17     public int completionFlags = JAVADOC;
18     public char[] completionIdentifier;
19
20     public CompletionOnJavadocQualifiedTypeReference(char[][] sources, char[] identifier, long[] pos, int tagStart, int tagEnd) {
21         super(sources, pos, tagStart, tagEnd);
22         this.completionIdentifier = identifier;
23     }
24
25     public CompletionOnJavadocQualifiedTypeReference(JavadocQualifiedTypeReference typeRef) {
26         super(typeRef.tokens, typeRef.sourcePositions, typeRef.tagSourceStart, typeRef.tagSourceStart);
27         this.completionIdentifier = CharOperation.NO_CHAR;
28     }
29
30     /**
31      * @param flags The completionFlags to set.
32      */

33     public void addCompletionFlags(int flags) {
34         this.completionFlags |= flags;
35     }
36
37     public boolean completeAnException() {
38         return (this.completionFlags & EXCEPTION) != 0;
39     }
40
41     public boolean completeInText() {
42         return (this.completionFlags & TEXT) != 0;
43     }
44
45     public boolean completeBaseTypes() {
46         return (this.completionFlags & BASE_TYPES) != 0;
47     }
48
49     public boolean completeFormalReference() {
50         return (this.completionFlags & FORMAL_REFERENCE) != 0;
51     }
52
53     /**
54      * Get completion node flags.
55      *
56      * @return int Flags of the javadoc completion node.
57      */

58     public int getCompletionFlags() {
59         return this.completionFlags;
60     }
61     /* (non-Javadoc)
62      * @see org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference#printExpression(int, java.lang.StringBuffer)
63      */

64     public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output) {
65         output.append("<CompletionOnJavadocQualifiedTypeReference:"); //$NON-NLS-1$
66
super.printExpression(indent, output);
67         indent++;
68         if (this.completionFlags > 0) {
69             output.append('\n');
70             for (int i=0; i<indent; i++) output.append('\t');
71             output.append("infos:"); //$NON-NLS-1$
72
char separator = 0;
73             if (completeAnException()) {
74                 output.append("exception"); //$NON-NLS-1$
75
separator = ',';
76             }
77             if (completeInText()) {
78                 if (separator != 0) output.append(separator);
79                 output.append("text"); //$NON-NLS-1$
80
separator = ',';
81             }
82             if (completeBaseTypes()) {
83                 if (separator != 0) output.append(separator);
84                 output.append("base types"); //$NON-NLS-1$
85
separator = ',';
86             }
87             if (completeFormalReference()) {
88                 if (separator != 0) output.append(separator);
89                 output.append("formal reference"); //$NON-NLS-1$
90
separator = ',';
91             }
92             output.append('\n');
93         }
94         indent--;
95         for (int i=0; i<indent; i++) output.append('\t');
96         return output.append('>');
97     }
98 }
99
Popular Tags