Java 类org.eclipse.jface.text.presentation.IPresentationRepairer 实例源码

项目:bts    文件:XtextSourceViewerConfiguration.java   
@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;
}
项目:tm4e    文件:TMPresentationReconciler.java   
@Override
public IPresentationRepairer getRepairer(String contentType) {
    return null;
}
项目:bts    文件:DefaultUiModule.java   
public Class<? extends IPresentationRepairer> bindIPresentationRepairer() {
    return PresentationRepairer.class;
}
项目:APICloud-Studio    文件:CommonPresentationReconciler.java   
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;
    }
}