org.eclipse.jface.text.reconciler.DirtyRegion Java Examples

The following examples show how to use org.eclipse.jface.text.reconciler.DirtyRegion. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaCompositeReconcilingStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	try {
		IProblemRequestorExtension e= getProblemRequestorExtension();
		if (e != null) {
			try {
				e.beginReportingSequence();
				super.reconcile(dirtyRegion, subRegion);
			} finally {
				e.endReportingSequence();
			}
		} else {
			super.reconcile(dirtyRegion, subRegion);
		}
	} finally {
		reconciled();
	}
}
 
Example #2
Source File: TypeScriptDocumentRegionProcessor.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Override process method to call folding strategy BEFORE validation which
 * can take time.
 */
@Override
protected void process(DirtyRegion dirtyRegion) {
	if (!isInstalled() /* || isInRewriteSession() */ || dirtyRegion == null || getDocument() == null)
		return;
	/*
	 * if there is a folding strategy then reconcile it for the entire dirty
	 * region. NOTE: the folding strategy does not care about the sub
	 * regions.
	 */
	if (getTypeScriptFoldingStrategy() != null) {
		getTypeScriptFoldingStrategy().reconcile(dirtyRegion, null);
	}

	super.process(dirtyRegion);

}
 
Example #3
Source File: IndentFoldingStrategy.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * <p>
 * Searches the given {@link DirtyRegion} for annotations that now have a
 * length of 0. This is caused when something that was being folded has been
 * deleted. These {@link FoldingAnnotation}s are then added to the
 * {@link List} of {@link FoldingAnnotation}s to be deleted
 * </p>
 * 
 * @param dirtyRegion
 *            find the now invalid {@link FoldingAnnotation}s in this
 *            {@link DirtyRegion}
 * @param deletions
 *            the current list of {@link FoldingAnnotation}s marked for
 *            deletion that the newly found invalid
 *            {@link FoldingAnnotation}s will be added to
 */
protected void markInvalidAnnotationsForDeletion(DirtyRegion dirtyRegion, List<FoldingAnnotation> deletions,
		List<FoldingAnnotation> existing) {
	Iterator iter = getAnnotationIterator(dirtyRegion);
	if (iter != null) {
		while (iter.hasNext()) {
			Annotation anno = (Annotation) iter.next();
			if (anno instanceof FoldingAnnotation) {
				FoldingAnnotation folding = (FoldingAnnotation) anno;
				Position pos = projectionAnnotationModel.getPosition(anno);
				if (pos.length == 0) {
					deletions.add(folding);
				} else {
					existing.add(folding);
				}
			}
		}
	}
}
 
Example #4
Source File: CompositeReconcilingStrategy.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	if (fStrategies == null)
		return;

	for (int i= 0; i < fStrategies.length; i++)
		fStrategies[i].reconcile(dirtyRegion, subRegion);
}
 
Example #5
Source File: CompositeReconcilingStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	if (fStrategies == null)
		return;

	for (int i= 0; i < fStrategies.length; i++)
		fStrategies[i].reconcile(dirtyRegion, subRegion);
}
 
Example #6
Source File: CompositeReconcilingStrategy.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion)
{
	for (IReconcilingStrategy strategy : fStrategies)
	{
		strategy.reconcile(dirtyRegion, subRegion);
	}
}
 
Example #7
Source File: IndentFoldingStrategy.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Given a {@link DirtyRegion} returns an {@link Iterator} of the already
 * existing annotations in that region.
 * 
 * @param dirtyRegion
 *            the {@link DirtyRegion} to check for existing annotations in
 * 
 * @return an {@link Iterator} over the annotations in the given
 *         {@link DirtyRegion}. The iterator could have no annotations in
 *         it. Or <code>null</code> if projection has been disabled.
 */
private Iterator getAnnotationIterator(DirtyRegion dirtyRegion) {
	Iterator annoIter = null;
	// be sure project has not been disabled
	if (projectionAnnotationModel != null) {
		// workaround for Platform Bug 299416
		int offset = dirtyRegion.getOffset();
		if (offset > 0) {
			offset--;
		}
		annoIter = projectionAnnotationModel.getAnnotationIterator(0, document.getLength(), false, false);
	}
	return annoIter;
}
 
Example #8
Source File: ModulaCompositeReconcilingStrategy.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    try {
        super.reconcile(dirtyRegion, subRegion);
    } finally {
        reconciled();
    }
}
 
Example #9
Source File: SourceCodeSpellingReconcileStrategy.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    if (isSpellingEnabled()) {
        super.reconcile(dirtyRegion, subRegion);
    }
}
 
Example #10
Source File: CompositeReconcilingStrategy.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    if (strategies == null)
        return;

    for (IReconcilingStrategy strategy : strategies) {
        strategy.reconcile(dirtyRegion, subRegion);
    }
}
 
Example #11
Source File: TLAReconcilingStrategy.java    From tlaplus with MIT License 4 votes vote down vote up
private void reconcile(final IRegion partition, final DirtyRegion dirtyRegion, final IRegion subRegion) {
	if (editor != null) {
		final HashMap<TLCProjectionAnnotation, Position> regionMap
												= determineFoldingRegions(partition, dirtyRegion, subRegion);
		final Annotation[] deletions;
		final HashMap<TLCProjectionAnnotation, Position> regionsToAdd = new HashMap<>();
		synchronized (currentAnnotations) {
			for (final Map.Entry<TLCProjectionAnnotation, Position> me : regionMap.entrySet()) {
				if (!currentAnnotations.remove(me.getKey())) {
					regionsToAdd.put(me.getKey(), me.getValue());
				}
			}
			
			deletions = currentAnnotations.toArray(new Annotation[currentAnnotations.size()]);
			currentAnnotations.clear();
			currentAnnotations.addAll(regionMap.keySet());
		}
		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
			public void run() {
				editor.modifyProjectionAnnotations(deletions, regionsToAdd);
				
				if (projectionViewer != null) {
					final ProjectionAnnotationModel model = projectionViewer.getProjectionAnnotationModel();
					final boolean block = foldBlockComments.get();
					final boolean pcal = foldPlusCalAlgorithm.get();
					final boolean translated = foldTranslatedPlusCalBlock.get();

					// We could do even more optimization than this, but this is better than none.
					if (block || pcal || translated) {
						for (final TLCProjectionAnnotation annotation : currentAnnotations) {
							final boolean collapse;

							switch (annotation.getTLCType()) {
								case BLOCK_COMMENT:
									collapse = block;
									break;
								case PCAL_BLOCK:
									collapse = pcal;
									break;
								default:
									collapse = translated;
							}

							if (collapse) {
								model.collapse(annotation);
							}
						}
					}
				}
			}
		});
	}
}
 
Example #12
Source File: TLAReconcilingStrategy.java    From tlaplus with MIT License 4 votes vote down vote up
/**
    * {@inheritDoc}
    */
   @Override
public void reconcile(final DirtyRegion dirtyRegion, final IRegion subRegion) {
   	reconcile(null, dirtyRegion, subRegion);
}
 
Example #13
Source File: ModulaReconcilingStrategy.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    reconcileInternal();
}
 
Example #14
Source File: JsonReconcilingStrategy.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    initialReconcile();
}
 
Example #15
Source File: CommitCommentArea.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
  reconcile(subRegion);
}
 
Example #16
Source File: CommonReconcilingStrategy.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion)
{
	// we can't do incremental yet
}
 
Example #17
Source File: JavaReconcilingStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	reconcile(false);
}
 
Example #18
Source File: XtextCodeMiningReconcileStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	// Do nothing
}
 
Example #19
Source File: ScriptReconcilingStrategy.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void reconcile( DirtyRegion dirtyRegion, IRegion subRegion )
{
	reconcile( subRegion );
}
 
Example #20
Source File: PyReconciler.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    reconcile(subRegion);
}
 
Example #21
Source File: XtextDocumentReconcileStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
	reconcile(subRegion);
}