1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 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 net.sourceforge.phpeclipse.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
16 import org.eclipse.core.resources.IFile;
17 import org.eclipse.core.runtime.IPath;
19 public class ImportReference extends ASTNode {
21 // public char[][] tokens;
22 // public long[] sourcePositions; //each entry is using the code : (start<<32) + end
23 public boolean onDemand = true; //most of the time
24 public final char[] includeSource;
25 public int declarationEnd;// doesn't include an potential trailing comment
26 public int declarationSourceStart;
27 public int declarationSourceEnd;
31 public ImportReference(char[] sourceString, int start, int end, boolean d) { // char[][] sources , long[] poss , boolean d) {
33 // sourcePositions = poss ;
34 includeSource = sourceString;
36 sourceEnd = end;//(int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
37 sourceStart = start;//(int)(sourcePositions[0]>>>32) ;
43 //public char[][] getImportName() {
47 public char[] getIncludeName() {
50 public String toString(int tab ){
52 return toString(tab,true);
54 public String toString(int tab, boolean withOnDemand) {
55 /* when withOnDemand is false, only the name is printed */
56 // StringBuffer buffer = new StringBuffer();
57 // for (int i = 0; i < tokens.length; i++) {
58 // buffer.append(tokens[i]);
59 // if (i < (tokens.length - 1)) {
60 // buffer.append("."); //$NON-NLS-1$
63 // if (withOnDemand && onDemand) {
64 // buffer.append(".*"); //$NON-NLS-1$
66 // return buffer.toString();
67 return new String(includeSource);
69 public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
70 visitor.visit(this, scope);
71 visitor.endVisit(this, scope);
74 * @return Returns the filePath.
76 public IFile getFile() {
80 * @param filePath The filePath to set.
82 public void setFile(IFile filePath) {