From a396c258f31ec8b498a264d2fbbf7ef51e95b643 Mon Sep 17 00:00:00 2001 From: kpouer Date: Sat, 25 Jan 2003 15:56:19 +0000 Subject: [PATCH] Some refactor to use the PHPSegmentWithChildren instead of PHPClassDeclaration --- .../phpeditor/PHPContentOutlinePage.java | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPContentOutlinePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPContentOutlinePage.java index 43e72ef..72cbeae 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPContentOutlinePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPContentOutlinePage.java @@ -20,10 +20,7 @@ import java.util.TreeSet; import net.sourceforge.phpdt.internal.ui.viewsupport.ImageDescriptorRegistry; import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import net.sourceforge.phpeclipse.phpeditor.phpparser.PHPClassDeclaration; -import net.sourceforge.phpeclipse.phpeditor.phpparser.PHPOutlineInfo; -import net.sourceforge.phpeclipse.phpeditor.phpparser.PHPParser; -import net.sourceforge.phpeclipse.phpeditor.phpparser.PHPSegment; +import net.sourceforge.phpeclipse.phpeditor.phpparser.*; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.text.BadPositionCategoryException; import org.eclipse.jface.text.DefaultPositionUpdater; @@ -53,10 +50,10 @@ public class PHPContentOutlinePage extends ContentOutlinePage { protected static class SegmentComparator implements Comparator { public int compare(Object o1, Object o2) { - if (o1 instanceof PHPClassDeclaration && !(o2 instanceof PHPClassDeclaration)) { + if (o1 instanceof PHPSegmentWithChildren && !(o2 instanceof PHPSegmentWithChildren)) { return 1; } - if (o2 instanceof PHPClassDeclaration && !(o1 instanceof PHPClassDeclaration)) { + if (o2 instanceof PHPSegmentWithChildren && !(o1 instanceof PHPSegmentWithChildren)) { return -1; } return ((PHPSegment) o1).toString().compareToIgnoreCase(((PHPSegment) o2).toString()); @@ -104,7 +101,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage { PHPOutlineInfo outlineInfo = parser.parseInfo(fInput, text); fVariables = outlineInfo.getVariables(); - PHPClassDeclaration declarations = outlineInfo.getDeclarations(); + PHPSegmentWithChildren declarations = outlineInfo.getDeclarations(); PHPSegment temp; for (int i = 0; i < declarations.size(); i++) { temp = declarations.get(i); @@ -182,8 +179,8 @@ public class PHPContentOutlinePage extends ContentOutlinePage { * @see ITreeContentProvider#hasChildren(Object) */ public boolean hasChildren(Object element) { - if (element instanceof PHPClassDeclaration) { - return !((PHPClassDeclaration) element).getList().isEmpty(); + if (element instanceof PHPSegmentWithChildren) { + return !((PHPSegmentWithChildren) element).getList().isEmpty(); } return element == fInput; } @@ -204,8 +201,8 @@ public class PHPContentOutlinePage extends ContentOutlinePage { public Object[] getChildren(Object element) { if (element == fInput) return fContent.toArray(); - if (element instanceof PHPClassDeclaration) - return ((PHPClassDeclaration) element).getList().toArray(); + if (element instanceof PHPSegmentWithChildren) + return ((PHPSegmentWithChildren) element).getList().toArray(); return new Object[0]; } }; -- 1.7.1