/** * 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); } }
/** * 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 documentPartitioningChanged(DocumentPartitioningChangedEvent event) { IRegion changedRegion= event.getChangedRegion(getDocumentPartitioning()); if (changedRegion != null) documentPartitioningChanged(event.getDocument(), changedRegion); }
@Override public void documentPartitioningChanged(DocumentPartitioningChangedEvent event) { IRegion changedRegion= event.getChangedRegion(getDocumentPartitioning()); if (changedRegion != null) documentPartitioningChanged(event.getDocument(), changedRegion); }
ITypedRegion[] partitioning= TextUtilities.computePartitioning(document, getDocumentPartitioning(), damage.getOffset(), damage.getLength(), false); for (int i= 0; i < partitioning.length; i++) { ITypedRegion r= partitioning[i];
/** * Constructs a "repair description" for the given damage and returns this * description as a text presentation. For this, it queries the partitioning * of the damage region and asks the appropriate presentation repairer for * each partition to construct the "repair description" for this partition. * * @param damage the damage to be repaired * @param document the document whose presentation must be repaired * @return the presentation repair description as text presentation or * <code>null</code> if the partitioning could not be computed */ protected TextPresentation createPresentation(IRegion damage, IDocument document) { try { if (fRepairers == null || fRepairers.isEmpty()) { TextPresentation presentation= new TextPresentation(damage, 100); presentation.setDefaultStyleRange(new StyleRange(damage.getOffset(), damage.getLength(), null, null)); return presentation; } TextPresentation presentation= new TextPresentation(damage, 1000); ITypedRegion[] partitioning= TextUtilities.computePartitioning(document, getDocumentPartitioning(), damage.getOffset(), damage.getLength(), false); for (ITypedRegion r : partitioning) { IPresentationRepairer repairer= getRepairer(r.getType()); if (repairer != null) repairer.createPresentation(presentation, r); } return presentation; } catch (BadLocationException x) { return null; } }