public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); SimpleDamagerRepairer dr = new SimpleDamagerRepairer(); reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); return reconciler; }
@Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); MarkupViewerDamagerRepairer dr = createMarkupViewerDamagerRepairer(); reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); return reconciler; }
/** * Processes the given damage. * @param damage the damage to be repaired * @param document the document whose presentation must be repaired */ private void processDamage(IRegion damage, IDocument document) { if (damage != null && damage.getLength() > 0) { TextPresentation p= createPresentation(damage, document); if (p != null) applyTextRegionCollection(p); } }
private void configureReconciler(PresentationReconciler reconciler, String partitionType, ITokenScanner scanner) { DefaultDamagerRepairer dr; dr = new DefaultDamagerRepairer(scanner); reconciler.setDamager(dr, partitionType); reconciler.setRepairer(dr, partitionType); }
/** * Returns the presentation reconciler ready to be used with the given source viewer. * * @param sourceViewer the source viewer * @return the presentation reconciler or <code>null</code> if presentation reconciling should not be supported */ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler= new PresentationReconciler(); reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); return reconciler; }
public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); configureReconciler(reconciler, IDocument.DEFAULT_CONTENT_TYPE, getBndScanner()); configureReconciler(reconciler, SINGLELINE_COMMENT_TYPE, getMultiLineCommentScanner()); return reconciler; }
@Override public void documentPartitioningChanged(DocumentPartitioningChangedEvent event) { IRegion changedRegion= event.getChangedRegion(getDocumentPartitioning()); if (changedRegion != null) documentPartitioningChanged(event.getDocument(), changedRegion); }
protected IRegion check(String before, int start, int replaceLength, String text) throws Exception { Document doc = createDocument(before); damager.setDocument(doc); doc.addDocumentListener(this); doc.replace(start, replaceLength, text); return lastRegion; }
@Override public void uninstall() { fViewer.removeTextInputListener(fInternalListener); // Ensure we uninstall all listeners fInternalListener.inputDocumentAboutToBeChanged(fViewer.getDocument(), null); }
/** * Returns the partition for the given offset in the given document. * * @param document the document * @param offset the offset * @return the partition * @throws BadLocationException if offset is invalid in the given document * @since 3.0 */ private ITypedRegion getPartition(IDocument document, int offset) throws BadLocationException { return TextUtilities.getPartition(document, getDocumentPartitioning(), offset, false); } }
@Override public void install(ITextViewer viewer) { Assert.isNotNull(viewer); fViewer= viewer; fViewer.addTextInputListener(fInternalListener); IDocument document= viewer.getDocument(); if (document != null) fInternalListener.inputDocumentChanged(null, document); }
@Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); DefaultDamagerRepairer dr = new DefaultDamagerRepairer(fPropertyKeyScanner); reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); dr = new DefaultDamagerRepairer(fPropertyValueScanner); reconciler.setDamager(dr, ManifestPartitionScanner.MANIFEST_HEADER_VALUE); reconciler.setRepairer(dr, ManifestPartitionScanner.MANIFEST_HEADER_VALUE); return reconciler; }
/** * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer) */ public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer ) { if ( damagerRepairer == null ) { damagerRepairer = new FilterDamagerRepairer( parser ); } if ( presentationReconciler == null ) { presentationReconciler = new PresentationReconciler(); presentationReconciler.setDamager( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE ); presentationReconciler.setRepairer( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE ); } return presentationReconciler; }
private void configureReconciler(PresentationReconciler reconciler, String partitionType, ITokenScanner scanner) { DefaultDamagerRepairer dr; dr = new DefaultDamagerRepairer(scanner); reconciler.setDamager(dr, partitionType); reconciler.setRepairer(dr, partitionType); }
/** * Returns the presentation reconciler ready to be used with the given source viewer. * * @param sourceViewer the source viewer * @return the presentation reconciler or <code>null</code> if presentation reconciling should not be supported */ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler= new PresentationReconciler(); reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); return reconciler; }
public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); configureReconciler(reconciler, IDocument.DEFAULT_CONTENT_TYPE, getBndScanner()); configureReconciler(reconciler, SINGLELINE_COMMENT_TYPE, getMultiLineCommentScanner()); return reconciler; }
/** * Processes the given damage. * @param damage the damage to be repaired * @param document the document whose presentation must be repaired */ private void processDamage(IRegion damage, IDocument document) { if (damage != null && damage.getLength() > 0) { TextPresentation p= createPresentation(damage, document); if (p != null) applyTextRegionCollection(p); } }
@Override public void documentPartitioningChanged(DocumentPartitioningChangedEvent event) { IRegion changedRegion= event.getChangedRegion(getDocumentPartitioning()); if (changedRegion != null) documentPartitioningChanged(event.getDocument(), changedRegion); }
@Override public void uninstall() { fViewer.removeTextInputListener(fInternalListener); // Ensure we uninstall all listeners fInternalListener.inputDocumentAboutToBeChanged(fViewer.getDocument(), null); }
/** * Returns the partition for the given offset in the given document. * * @param document the document * @param offset the offset * @return the partition * @throws BadLocationException if offset is invalid in the given document * @since 3.0 */ private ITypedRegion getPartition(IDocument document, int offset) throws BadLocationException { return TextUtilities.getPartition(document, getDocumentPartitioning(), offset, false); } }