forked from ariatemplates/editor-frontend-eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPOCDocumentPartitioner.java
More file actions
51 lines (39 loc) · 1.57 KB
/
POCDocumentPartitioner.java
File metadata and controls
51 lines (39 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package poc.document;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.TypedRegion;
public class POCDocumentPartitioner implements IDocumentPartitioner {
public static final String PARTITION_NAME = "MAIN" ;
private static final String[] types = {POCDocumentPartitioner.PARTITION_NAME};
private ITypedRegion region = null;
/***************************************************************************
* Partitioning
**************************************************************************/
@Override
public String[] getLegalContentTypes() {
return POCDocumentPartitioner.types;
}
@Override
public String getContentType(int offset) {
return POCDocumentPartitioner.PARTITION_NAME;
}
@Override
public ITypedRegion[] computePartitioning(int offset, int length) {
this.region = new TypedRegion(offset, length, POCDocumentPartitioner.PARTITION_NAME);
ITypedRegion[] regions = {this.region};
return regions;
}
@Override
public ITypedRegion getPartition(int offset) {
return this.region;
}
/***************************************************************************
* Unused
**************************************************************************/
@Override public void connect(IDocument document) {}
@Override public void disconnect() {}
@Override public void documentAboutToBeChanged(DocumentEvent event) {}
@Override public boolean documentChanged(DocumentEvent event) {return false;}
}