use of org.eclipse.jface.text.source.projection.ProjectionAnnotationModel in project dbeaver by serge-rider.
the class SQLReconcilingStrategy method calculatePositions.
protected void calculatePositions() {
ProjectionAnnotationModel annotationModel = editor.getAnnotationModel();
if (annotationModel == null) {
return;
}
Set<SQLScriptPosition> removedPositions = editor.getRuleManager().getRemovedPositions(true);
Set<SQLScriptPosition> addedPositions = editor.getRuleManager().getAddedPositions(true);
Annotation[] removedAnnotations = null;
if (!removedPositions.isEmpty()) {
removedAnnotations = new Annotation[removedPositions.size()];
int index = 0;
for (SQLScriptPosition pos : removedPositions) {
removedAnnotations[index++] = pos.getFoldingAnnotation();
}
}
Map<Annotation, Position> addedAnnotations = null;
if (!addedPositions.isEmpty()) {
addedAnnotations = new HashMap<>();
for (SQLScriptPosition pos : addedPositions) {
addedAnnotations.put(pos.getFoldingAnnotation(), pos);
}
}
if (removedAnnotations != null || addedAnnotations != null) {
annotationModel.modifyAnnotations(removedAnnotations, addedAnnotations, null);
}
/*
final List<Position> positions;
try {
positions = parseRegion();
} catch (BadLocationException e) {
e.printStackTrace();
return;
}
*/
/*
Display.getDefault().asyncExec(new Runnable()
{
public void run()
{
editor.updateFoldingStructure(regionOffset, regionLength, positions);
}
});
*/
}
Aggregations