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;
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());
* @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;
}
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];
}
};
public OutlineLabelProvider() {
fRegistry = PHPeclipsePlugin.getImageDescriptorRegistry();
- ;
}
/**
* The <code>LabelProvider</code> implementation of this
if (selection.isEmpty())
fTextEditor.resetHighlightRange();
else {
- PHPSegment segment = (PHPSegment) ((IStructuredSelection) selection).getFirstElement();
+ Outlineable segment = (Outlineable) ((IStructuredSelection) selection).getFirstElement();
int start = segment.getPosition().getOffset();
int length = segment.getPosition().getLength();
try {