use of org.eclipse.che.ide.api.editor.text.Region in project che by eclipse.
the class DocumentPartitioningChangedEvent method getCoverage.
/**
* Returns the coverage of this event. This is the minimal region that contains all changed regions of all changed
* partitionings.
*
* @return the coverage of this event
*/
public Region getCoverage() {
if (fMap.isEmpty())
return new RegionImpl(0, 0);
int offset = -1;
int endOffset = -1;
Iterator<Region> e = fMap.values().iterator();
while (e.hasNext()) {
Region r = e.next();
if (offset < 0 || r.getOffset() < offset)
offset = r.getOffset();
int end = r.getOffset() + r.getLength();
if (end > endOffset)
endOffset = end;
}
return new RegionImpl(offset, endOffset - offset);
}
use of org.eclipse.che.ide.api.editor.text.Region in project che by eclipse.
the class ReconcilerWithAutoSave method process.
/**
* Processes a dirty region. If the dirty region is <code>null</code> the whole document is consider being dirty. The dirty region is
* partitioned by the document and each partition is handed over to a reconciling strategy registered for the partition's content type.
*
* @param dirtyRegion the dirty region to be processed
*/
protected void process(final DirtyRegion dirtyRegion) {
Region region = dirtyRegion;
if (region == null) {
region = new RegionImpl(0, getDocument().getContents().length());
}
final List<TypedRegion> regions = computePartitioning(region.getOffset(), region.getLength());
for (final TypedRegion r : regions) {
final ReconcilingStrategy strategy = getReconcilingStrategy(r.getType());
if (strategy == null) {
continue;
}
if (dirtyRegion != null) {
strategy.reconcile(dirtyRegion, r);
} else {
strategy.reconcile(r);
}
}
}
use of org.eclipse.che.ide.api.editor.text.Region in project che by eclipse.
the class MultiTextEdit method defineRegion.
void defineRegion(int parentOffset) {
if (fDefined)
return;
if (hasChildren()) {
Region region = getCoverage(getChildren());
internalSetOffset(region.getOffset());
internalSetLength(region.getLength());
} else {
internalSetOffset(parentOffset);
internalSetLength(0);
}
fDefined = true;
}
Aggregations