KickJava   Java API By Example, From Geeks To Geeks.

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


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.JavadocMessageSend;
14
15 public class CompletionOnJavadocMessageSend extends JavadocMessageSend implements CompletionOnJavadoc {
16     public int completionFlags = JAVADOC;
17     public int separatorPosition;
18
19     public CompletionOnJavadocMessageSend(JavadocMessageSend method, int position) {
20         super(method.selector, method.nameSourcePosition);
21         this.arguments = method.arguments;
22         this.receiver = method.receiver;
23         this.sourceEnd = method.sourceEnd;
24         this.tagValue = method.tagValue;
25         this.separatorPosition = position;
26     }
27
28     public CompletionOnJavadocMessageSend(JavadocMessageSend method, int position, int flags) {
29         this(method, position);
30         this.completionFlags |= flags;
31     }
32
33     /**
34      * @param flags The completionFlags to set.
35      */

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

61     public int getCompletionFlags() {
62         return this.completionFlags;
63     }
64
65     /* (non-Javadoc)
66      * @see org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend#printExpression(int, java.lang.StringBuffer)
67      */

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