8c1a4604d8433497822fc24a1c7f927f7a532a96
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / ImportReference.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
15
16 import org.eclipse.core.resources.IFile;
17 import org.eclipse.core.runtime.IPath;
18
19 public class ImportReference extends ASTNode {
20         
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;
28         public boolean used; 
29         private IFile fFile;
30
31 public ImportReference(char[] sourceString, int start, int end, boolean d) { // char[][] sources , long[] poss , boolean d) {
32 //      tokens = sources ;
33 //      sourcePositions = poss ;
34     includeSource = sourceString;
35         onDemand = d;
36         sourceEnd = end;//(int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
37         sourceStart = start;//(int)(sourcePositions[0]>>>32) ;
38         fFile = null;
39 }
40 /**
41  * @return char[][]
42  */
43 //public char[][] getImportName() {
44 //      return tokens;
45 //}
46
47 public char[] getIncludeName() {
48 return includeSource;
49 }
50 public String toString(int tab ){
51
52         return toString(tab,true);
53 }
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$
61 //              }
62 //      }
63 //      if (withOnDemand && onDemand) {
64 //              buffer.append(".*"); //$NON-NLS-1$
65 //      }
66 //      return buffer.toString();
67     return new String(includeSource);
68 }
69 public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
70         visitor.visit(this, scope);
71         visitor.endVisit(this, scope);
72 }
73 /**
74  * @return Returns the filePath.
75  */
76 public IFile getFile() {
77   return fFile;
78 }
79 /**
80  * @param filePath The filePath to set.
81  */
82 public void setFile(IFile filePath) {
83   fFile = filePath;
84 }
85 }