KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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 /*
14  * Completion node build by the parser in any case it was intending to
15  * reduce an exception type reference containing the completion identifier
16  * as part of a qualified name.
17  * e.g.
18  *
19  * class X {
20  * void foo() {
21  * try {
22  * bar();
23  * } catch (java.io.IOExc[cursor] e) {
24  * }
25  * }
26  * }
27  *
28  * ---> class X {
29  * void foo() {
30  * try {
31  * bar();
32  * } catch (<CompleteOnException:java.io.IOExc> e) {
33  * }
34  * }
35  * }
36  *
37  * The source range of the completion node denotes the source range
38  * which should be replaced by the completion.
39  */

40 public class CompletionOnQualifiedExceptionReference extends CompletionOnQualifiedTypeReference {
41 public CompletionOnQualifiedExceptionReference(char[][] previousIdentifiers, char[] completionIdentifier, long[] positions) {
42     super(previousIdentifiers, completionIdentifier, positions);
43 }
44 public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output) {
45
46     output.append("<CompleteOnException:"); //$NON-NLS-1$
47
for (int i = 0; i < tokens.length; i++) {
48         output.append(tokens[i]);
49         output.append('.');
50     }
51     output.append(completionIdentifier).append('>');
52     return output;
53 }
54 }
55
Popular Tags