KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > parser > RecoveredImport


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.compiler.parser;
12
13 /**
14  * Internal import structure for parsing recovery
15  */

16 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
17 import org.eclipse.jdt.internal.compiler.ast.ImportReference;
18
19 public class RecoveredImport extends RecoveredElement {
20
21     public ImportReference importReference;
22 public RecoveredImport(ImportReference importReference, RecoveredElement parent, int bracketBalance){
23     super(parent, bracketBalance);
24     this.importReference = importReference;
25 }
26 /*
27  * Answer the associated parsed structure
28  */

29 public ASTNode parseTree(){
30     return importReference;
31 }
32 /*
33  * Answer the very source end of the corresponding parse node
34  */

35 public int sourceEnd(){
36     return this.importReference.declarationSourceEnd;
37 }
38 public String JavaDoc toString(int tab) {
39     return tabString(tab) + "Recovered import: " + importReference.toString(); //$NON-NLS-1$
40
}
41 public ImportReference updatedImportReference(){
42
43     return importReference;
44 }
45 public void updateParseTree(){
46     this.updatedImportReference();
47 }
48 /*
49  * Update the declarationSourceEnd of the corresponding parse node
50  */

51 public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){
52     if (this.importReference.declarationSourceEnd == 0) {
53         this.importReference.declarationSourceEnd = bodyEnd;
54         this.importReference.declarationEnd = bodyEnd;
55     }
56 }
57 }
58
Popular Tags