org.eclipse.jface.text.presentation.IPresentationRepairer Java Examples

The following examples show how to use org.eclipse.jface.text.presentation.IPresentationRepairer. 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: XtextSourceViewerConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	XtextPresentationReconciler reconciler = getPresentationReconcilerProvider().get();
	reconciler.setDocumentPartitioning(getDocumentPartitioning(sourceViewer));
	IPresentationRepairer repairer = repairerProvider.get();
	IPresentationDamager damager = damagerProvider.get();
	String[] types = partitionTypesMapper.getSupportedPartitionTypes();
	for (String partitionType : types) {
		reconciler.setRepairer(repairer, partitionType);
		reconciler.setDamager(damager, partitionType);
	}
	return reconciler;
}
 
Example #2
Source File: TMPresentationReconciler.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationRepairer getRepairer(String contentType) {
	return null;
}
 
Example #3
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPresentationRepairer> bindIPresentationRepairer() {
	return PresentationRepairer.class;
}
 
Example #4
Source File: CommonPresentationReconciler.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected TextPresentation createPresentation(IRegion damage, IDocument document, IProgressMonitor monitor)
{
	try
	{
		int damageOffset = damage.getOffset();
		int damageLength = damage.getLength();
		if (damageOffset + damageLength > document.getLength())
		{
			int adjustedLength = document.getLength() - damageOffset;
			synchronized (this)
			{
				delayedRegions.remove(new Region(document.getLength(), damageLength - adjustedLength));
			}
			if (adjustedLength <= 0)
			{
				return null;
			}
			damageLength = adjustedLength;
		}
		TextPresentation presentation = new TextPresentation(damage, iterationPartitionLimit * 5);
		ITypedRegion[] partitioning = TextUtilities.computePartitioning(document, getDocumentPartitioning(),
				damageOffset, damageLength, false);
		if (partitioning.length == 0)
		{
			return presentation;
		}
		int limit = Math.min(iterationPartitionLimit, partitioning.length);
		int processingLength = partitioning[limit - 1].getOffset() + partitioning[limit - 1].getLength()
				- damageOffset;
		if (EclipseUtil.showSystemJobs())
		{
			monitor.subTask(MessageFormat.format(
					"processing region at offset {0}, length {1} in document of length {2}", damageOffset, //$NON-NLS-1$
					processingLength, document.getLength()));
		}

		for (int i = 0; i < limit; ++i)
		{
			ITypedRegion r = partitioning[i];
			IPresentationRepairer repairer = getRepairer(r.getType());
			if (monitor.isCanceled())
			{
				return null;
			}
			if (repairer != null)
			{
				repairer.createPresentation(presentation, r);
			}
			monitor.worked(r.getLength());
		}

		synchronized (this)
		{
			delayedRegions.remove(new Region(damageOffset, processingLength));
			if (limit < partitioning.length)
			{
				int offset = partitioning[limit].getOffset();
				delayedRegions.append(new Region(offset, damageOffset + damageLength - offset));
			}
		}
		return presentation;
	}
	catch (BadLocationException e)
	{
		return null;
	}
}