initial contribution
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / batch / CompilationUnit.java
index 56e3ae0..0971b28 100644 (file)
@@ -1,18 +1,19 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
+ * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.batch;
 
 import java.io.File;
 import java.io.IOException;
 
+import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.util.Util;
 
@@ -48,26 +49,27 @@ public CompilationUnit(char[] contents, String fileName, String encoding) {
        this.encoding = encoding;
 }
 public char[] getContents() {
-       if (contents != null)
-               return contents;   // answer the cached source
+       if (this.contents != null)
+               return this.contents;   // answer the cached source
 
        // otherwise retrieve it
        try {
-               return Util.getFileCharContent(new File(new String(fileName)), encoding);
+               return Util.getFileCharContent(new File(new String(this.fileName)), this.encoding);
        } catch (IOException e) {
+               // assume no content then
        }
-       return new char[0];
+       return CharOperation.NO_CHAR;
 }
 public char[] getFileName() {
-       return fileName;
+       return this.fileName;
 }
 public char[] getMainTypeName() {
-       return mainTypeName;
+       return this.mainTypeName;
 }
 public char[][] getPackageName() {
        return null;
 }
 public String toString() {
-       return "CompilationUnit[" + new String(fileName) + "]";  //$NON-NLS-2$ //$NON-NLS-1$
+       return "CompilationUnit[" + new String(this.fileName) + "]";  //$NON-NLS-2$ //$NON-NLS-1$
 }
 }