8fc5dce28ca4ab914a60a7072ee135d0904e9409
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / lookup / ImportBinding.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.phpdt.internal.compiler.lookup;
12
13 import net.sourceforge.phpdt.core.compiler.CharOperation;
14 import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
15
16 public class ImportBinding extends Binding {
17         public char[][] compoundName;
18         public boolean onDemand;
19         public ImportReference reference;
20
21         Binding resolvedImport; // must ensure the import is resolved
22         
23 public ImportBinding(char[][] compoundName, boolean isOnDemand, Binding binding, ImportReference reference) {
24         this.compoundName = compoundName;
25         this.onDemand = isOnDemand;
26         this.resolvedImport = binding;
27         this.reference = reference;
28 }
29 /* API
30 * Answer the receiver's binding type from Binding.BindingID.
31 */
32
33 public final int bindingType() {
34         return IMPORT;
35 }
36 public char[] readableName() {
37         if (onDemand)
38                 return CharOperation.concat(CharOperation.concatWith(compoundName, '.'), ".*".toCharArray()); //$NON-NLS-1$
39         else
40                 return CharOperation.concatWith(compoundName, '.');
41 }
42 public String toString() {
43         return "import : " + new String(readableName()); //$NON-NLS-1$
44 }
45 }