use of org.eclipse.jface.text.rules.FastPartitioner in project egit by eclipse.
the class DiffDocument method connect.
/**
* Sets up the document to use information from the given
* {@link DiffRegionFormatter} for partitioning the document into
* partitions for file headlines, hunk headers, and added or removed lines.
* It is assumed that the given formatter has been used to generate content
* into the document.
*
* @param formatter
* to obtain information from
*/
public void connect(DiffRegionFormatter formatter) {
regions = formatter.getRegions();
fileRegions = formatter.getFileRegions();
if ((fileRegions == null || fileRegions.length == 0) && defaultRepository != null && defaultFileDiff != null) {
fileRegions = new FileDiffRegion[] { new FileDiffRegion(defaultRepository, defaultFileDiff, 0, getLength()) };
}
newPathPattern = Pattern.compile(// $NON-NLS-1$
Pattern.quote(formatter.getNewPrefix()) + "\\S+");
oldPathPattern = Pattern.compile(// $NON-NLS-1$
Pattern.quote(formatter.getOldPrefix()) + "\\S+");
maximumLineNumbers = formatter.getMaximumLineNumbers();
// Connect a new partitioner.
IDocumentPartitioner partitioner = new FastPartitioner(new DiffPartitionTokenScanner(), new String[] { IDocument.DEFAULT_CONTENT_TYPE, HEADLINE_CONTENT_TYPE, HUNK_CONTENT_TYPE, ADDED_CONTENT_TYPE, REMOVED_CONTENT_TYPE });
IDocumentPartitioner oldPartitioner = getDocumentPartitioner();
if (oldPartitioner != null) {
oldPartitioner.disconnect();
}
partitioner.connect(this);
setDocumentPartitioner(partitioner);
}
use of org.eclipse.jface.text.rules.FastPartitioner in project jbosstools-hibernate by jbosstools.
the class HQLEditorDocumentSetupParticipant method setup.
/**
* Sets up the document to be ready for use by a text file buffer.
*
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
*/
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
partitioner = new FastPartitioner(new HQLPartitionScanner(), HQLPartitionScanner.HQL_PARTITION_TYPES);
partitioner.connect(document);
extension3.setDocumentPartitioner(HQLSourceViewerConfiguration.HQL_PARTITIONING, partitioner);
}
}
Aggregations