KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.complete;
12
13 import org.eclipse.jdt.internal.compiler.ast.BranchStatement;
14 import org.eclipse.jdt.internal.compiler.flow.FlowContext;
15 import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
16 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
17
18 public class CompletionOnBrankStatementLabel extends BranchStatement {
19     public static final int BREAK = 1;
20     public static final int CONTINUE = 2;
21     
22     private int kind;
23     public char[][] possibleLabels;
24     
25     public CompletionOnBrankStatementLabel(int kind, char[] l, int s, int e, char[][] possibleLabels) {
26         super(l, s, e);
27         this.kind = kind;
28         this.possibleLabels = possibleLabels;
29     }
30
31     public FlowInfo analyseCode(BlockScope currentScope,
32             FlowContext flowContext, FlowInfo flowInfo) {
33         // Is never called
34
return null;
35     }
36
37     public void resolve(BlockScope scope) {
38         throw new CompletionNodeFound(this, scope);
39     }
40     public StringBuffer JavaDoc printStatement(int indent, StringBuffer JavaDoc output) {
41         printIndent(indent, output);
42         if(kind == CONTINUE) {
43             output.append("continue "); //$NON-NLS-1$
44
} else {
45             output.append("break "); //$NON-NLS-1$
46
}
47         output.append("<CompleteOnLabel:"); //$NON-NLS-1$
48
output.append(label);
49         return output.append(">;"); //$NON-NLS-1$
50
}
51
52 }
53
Popular Tags