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 Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.parser;
14 * Internal import structure for parsing recovery
16 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
17 import org.eclipse.jdt.internal.compiler.ast.ImportReference;
19 public class RecoveredImport extends RecoveredElement {
21 public ImportReference importReference;
22 public RecoveredImport(ImportReference importReference, RecoveredElement parent, int bracketBalance){
23 super(parent, bracketBalance);
24 this.importReference = importReference;
27 * Answer the associated parsed structure
29 public ASTNode parseTree(){
30 return importReference;
33 * Answer the very source end of the corresponding parse node
35 public int sourceEnd(){
36 return this.importReference.declarationSourceEnd;
38 public String toString(int tab) {
39 return tabString(tab) + "Recovered import: " + importReference.toString(); //$NON-NLS-1$
41 public ImportReference updatedImportReference(){
43 return importReference;
45 public void updateParseTree(){
46 this.updatedImportReference();
49 * Update the declarationSourceEnd of the corresponding parse node
51 public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){
52 if (this.importReference.declarationSourceEnd == 0) {
53 this.importReference.declarationSourceEnd = bodyEnd;
54 this.importReference.declarationEnd = bodyEnd;