01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.codeassist.complete;
11:
12: import org.eclipse.jdt.internal.compiler.ast.BranchStatement;
13: import org.eclipse.jdt.internal.compiler.flow.FlowContext;
14: import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
15: import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16:
17: public class CompletionOnBrankStatementLabel extends BranchStatement {
18: public static final int BREAK = 1;
19: public static final int CONTINUE = 2;
20:
21: private int kind;
22: public char[][] possibleLabels;
23:
24: public CompletionOnBrankStatementLabel(int kind, char[] l, int s,
25: 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:
41: public StringBuffer printStatement(int indent, StringBuffer output) {
42: printIndent(indent, output);
43: if (kind == CONTINUE) {
44: output.append("continue "); //$NON-NLS-1$
45: } else {
46: output.append("break "); //$NON-NLS-1$
47: }
48: output.append("<CompleteOnLabel:"); //$NON-NLS-1$
49: output.append(label);
50: return output.append(">;"); //$NON-NLS-1$
51: }
52:
53: }
|