import java.util.List;
import java.util.TreeSet;
+import net.sourceforge.phpdt.internal.compiler.parser.*;
import net.sourceforge.phpdt.internal.ui.viewsupport.ImageDescriptorRegistry;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-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.PHPSegmentWithChildren;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.BadPositionCategoryException;
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
if (o2 instanceof PHPSegmentWithChildren && !(o1 instanceof PHPSegmentWithChildren)) {
return -1;
}
- return ((PHPSegment) o1).toString().compareToIgnoreCase(((PHPSegment) o2).toString());
+ return ((Outlineable) o1).toString().compareToIgnoreCase(((Outlineable) o2).toString());
}
}
// StringBuffer identifier = new StringBuffer();
// while (i < textLength) {
// c = text.charAt(i++);
- // if (Character.isJavaIdentifierPart(c) || (c == '$')) {
+ // if (Scanner.isPHPIdentifierPart(c) || (c == '$')) {
// identifier.append(c);
// } else if ((i == firstIndex + 1) && (c == '$')) {
// identifier.append(c);
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();
- PHPSegmentWithChildren declarations = outlineInfo.getDeclarations();
- PHPSegment temp;
+ OutlineableWithChildren declarations = outlineInfo.getDeclarations();
+ Outlineable temp;
for (int i = 0; i < declarations.size(); i++) {
temp = declarations.get(i);
fContent.add(temp);
}
Collections.sort(fContent, new SegmentComparator());
-
}
/*
* @see ITreeContentProvider#getParent(Object)
*/
public Object getParent(Object element) {
- if (element instanceof PHPSegment) {
- return ((PHPSegment) element).getParent();
+ if (element instanceof Outlineable) {
+ return ((Outlineable) element).getParent();
}
return null;
}
* override.
*/
public Image getImage(Object element) {
- if (element instanceof PHPSegment) {
- ImageDescriptor descriptor = ((PHPSegment) element).getImage();
+ if (element instanceof Outlineable) {
+ ImageDescriptor descriptor = ((Outlineable) element).getImage();
return fRegistry.get(descriptor);
}
return null;