KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.JavadocAllocationExpression;
14
15 public class CompletionOnJavadocAllocationExpression extends JavadocAllocationExpression implements CompletionOnJavadoc {
16     public int completionFlags = JAVADOC;
17     public int separatorPosition;
18
19     public CompletionOnJavadocAllocationExpression(JavadocAllocationExpression allocation, int position) {
20         super(allocation.sourceStart, allocation.sourceEnd);
21         this.arguments = allocation.arguments;
22         this.type = allocation.type;
23         this.tagValue = allocation.tagValue;
24         this.sourceEnd = allocation.sourceEnd;
25         this.separatorPosition = position;
26         this.qualification = allocation.qualification;
27     }
28
29     public CompletionOnJavadocAllocationExpression(JavadocAllocationExpression allocation, int position, int flags) {
30         this(allocation, position);
31         this.completionFlags |= flags;
32     }
33
34     /**
35      * @param flags The completionFlags to set.
36      */

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

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

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