--- /dev/null
+package net.sourceforge.phpdt.internal.compiler.parser;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Here is an interface that object that can be in the outline view must implement.
+ * @author Matthieu Casanova
+ */
+public interface Outlineable {
+
+  /**
+   * This will return the image for the outline of the object.
+   * @return an image
+   */
+  ImageDescriptor getImage();
+
+  Object getParent();
+}
 
--- /dev/null
+package net.sourceforge.phpdt.internal.compiler.parser;
+
+/**
+ * The interface that will describe an object that can have children
+ * @author Matthieu Casanova
+ */
+public interface OutlineableWithChildren extends Outlineable {
+  boolean add(Outlineable o);
+
+  Outlineable get(int index);
+
+  int size();
+}
 
 package net.sourceforge.phpdt.internal.compiler.parser;
 
+import net.sourceforge.phpdt.internal.compiler.ast.PHPDocument;
+
 import java.util.TreeSet;
 
 /**
  */
 public class PHPOutlineInfo {
   TreeSet fVariables;
-  PHPSegmentWithChildren fDeclarations;
+  OutlineableWithChildren fDeclarations;
 
   public PHPOutlineInfo(Object parent) {
     fVariables = new TreeSet();
     fDeclarations = new PHPClassDeclaration(parent, "_root", 1);
   }
 
+  public PHPOutlineInfo(Object parent, OutlineableWithChildren phpDocument) {
+    fVariables = new TreeSet();
+    fDeclarations = phpDocument;
+  }
+
   public TreeSet getVariables() {
     return fVariables;
   }
 
-  public PHPSegmentWithChildren getDeclarations() {
+  public OutlineableWithChildren getDeclarations() {
     return fDeclarations;
   }
 
 
 package net.sourceforge.phpdt.internal.compiler.parser;
 
-import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.text.Position;
 
 /**
  * 
  * @author khartlage
  */
-public abstract class PHPSegment {
+public abstract class PHPSegment implements Outlineable {
   protected String name;
   private Position position;
   private Object parent;
     return parent;
   }
 
-  public abstract ImageDescriptor getImage();
 };
\ No newline at end of file
 
  * An abstract PHPSegment that can have children.
  * @author khartlage, Matthieu Casanova
  */
-public abstract class PHPSegmentWithChildren extends PHPSegment {
+public abstract class PHPSegmentWithChildren extends PHPSegment implements OutlineableWithChildren {
   private ArrayList children;
 
   /**
    * @param o function declaration to be appended to this list.
    * @return <tt>true</tt> (as per the general contract of Collection.add).
    */
-  public boolean add(PHPSegment o) {
+  public boolean add(Outlineable o) {
     return children.add(o);
   }
 
    * @throws    java.lang.IndexOutOfBoundsException if index is out of range <tt>(index
    *      < 0 || index >= size())</tt>.
    */
-  public PHPSegment get(int index) {
-    return (PHPSegment) children.get(index);
+  public Outlineable get(int index) {
+    return (Outlineable) children.get(index);
   }
 
   /**
 
     this.initializeScanner();
   }
   /**
-   *  Class Constructor.
+   *  ClassDeclaration Constructor.
    *
    *@param  s
    *@param  sess  Description of Parameter
 
   private void parseDeclarations(
     PHPOutlineInfo outlineInfo,
-    PHPSegmentWithChildren current,
+    OutlineableWithChildren current,
     boolean goBack) {
     char[] ident;
     //   PHPClassDeclaration current = (PHPClassDeclaration) stack.peek();
         if (token == TokenNameIdentifier) {
           getNextToken();
         } else {
-          throwSyntaxError("Class name expected after keyword 'extends'.");
+          throwSyntaxError("ClassDeclaration name expected after keyword 'extends'.");
         }
       }
     } else {
         throwSyntaxError(
           "Don't use keyword for class declaration [" + token + "].");
       }
-      throwSyntaxError("Class name expected after keyword 'class'.");
+      throwSyntaxError("ClassDeclaration name expected after keyword 'class'.");
     }
   }