KickJava   Java API By Example, From Geeks To Geeks.

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


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.internal.compiler.ast.JavadocSingleTypeReference;
14
15 public class CompletionOnJavadocSingleTypeReference extends JavadocSingleTypeReference implements CompletionOnJavadoc {
16     public int completionFlags = JAVADOC;
17
18     public CompletionOnJavadocSingleTypeReference(char[] source, long pos, int tagStart, int tagEnd) {
19         super(source, pos, tagStart, tagEnd);
20     }
21
22     public CompletionOnJavadocSingleTypeReference(JavadocSingleTypeReference typeRef) {
23         super(typeRef.token, (((long)typeRef.sourceStart)<<32)+typeRef.sourceEnd, typeRef.tagSourceStart, typeRef.tagSourceStart);
24     }
25
26     /**
27      * @param flags The completionFlags to set.
28      */

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

54     public int getCompletionFlags() {
55         return this.completionFlags;
56     }
57
58     /* (non-Javadoc)
59      * @see org.eclipse.jdt.internal.compiler.ast.SingleTypeReference#printExpression(int, java.lang.StringBuffer)
60      */

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