3
* Created: Jul 25, 2003
4
* License: Common Public License v1.0
6
package org.python.pydev.outline;
8
import org.eclipse.jface.text.BadLocationException;
9
import org.eclipse.jface.text.IDocument;
10
import org.eclipse.jface.text.Position;
11
import org.eclipse.jface.viewers.LabelProvider;
15
* In RawPartition, elements are Position markers inside the document
16
* we need reference to the document to get its text.
17
* I whish I had access to DocumentAdapter in SourceViewer, but I do not
19
class RawPartitionLabelProvider extends LabelProvider {
23
RawPartitionLabelProvider(IDocument document) {
24
this.document = document;
28
* @param element is a org.eclipse.jface.text.Position
30
public String getText(Object element) {
31
Position p = (Position)element;
33
// get the text from the document, truncate if needed
34
boolean trim = p.length > 50;
35
String text = document.get(p.offset, trim ? 30 : p.length);
40
} catch (BadLocationException e) {
42
"PyOutlinePage::OutlineLabelProvider unexpected error");
b'\\ No newline at end of file'