The methods to get variables do not instantiate ArrayList each time, only one is...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPContentOutlinePage.java
index ca2b95a..b091a43 100644 (file)
@@ -27,10 +27,7 @@ import net.sourceforge.phpdt.internal.ui.viewsupport.ImageDescriptorRegistry;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPositionUpdater;
+import org.eclipse.jface.text.*;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -56,10 +53,10 @@ public class PHPContentOutlinePage extends AbstractContentOutlinePage {
 
   protected static class SegmentComparator implements Comparator {
     public int compare(Object o1, Object o2) {
-      if (o1 instanceof PHPSegmentWithChildren && !(o2 instanceof PHPSegmentWithChildren)) {
+      if (o1 instanceof OutlineableWithChildren && !(o2 instanceof OutlineableWithChildren)) {
         return 1;
       }
-      if (o2 instanceof PHPSegmentWithChildren && !(o1 instanceof PHPSegmentWithChildren)) {
+      if (o2 instanceof OutlineableWithChildren && !(o1 instanceof OutlineableWithChildren)) {
         return -1;
       }
       return ((Outlineable) o1).toString().compareToIgnoreCase(((Outlineable) o2).toString());
@@ -184,8 +181,8 @@ public class PHPContentOutlinePage extends AbstractContentOutlinePage {
      * @see ITreeContentProvider#hasChildren(Object)
      */
     public boolean hasChildren(Object element) {
-      if (element instanceof PHPSegmentWithChildren) {
-        return !((PHPSegmentWithChildren) element).getList().isEmpty();
+      if (element instanceof OutlineableWithChildren) {
+        return !((OutlineableWithChildren) element).getList().isEmpty();
       }
       return element == fInput;
     }
@@ -206,8 +203,8 @@ public class PHPContentOutlinePage extends AbstractContentOutlinePage {
     public Object[] getChildren(Object element) {
       if (element == fInput)
         return fContent.toArray();
-      if (element instanceof PHPSegmentWithChildren)
-        return ((PHPSegmentWithChildren) element).getList().toArray();
+      if (element instanceof OutlineableWithChildren)
+        return ((OutlineableWithChildren) element).getList().toArray();
       return new Object[0];
     }
   };