import java.util.List;
import java.util.TreeSet;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPSegment;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPSegmentWithChildren;
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 org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import test.PHPParserSuperclass;
+import test.PHPParserManager;
/**
* A content outline page which always represents the functions of the
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());
String name;
int index;
String text = document.get();
- PHPParser parser = new PHPParser(null);
+ PHPParserSuperclass parser = PHPParserManager.getParser(null);
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);
* @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;
}
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];
}
};