/** * Informs all registered repairers about the document on which they will work. * * @param document the document on which to work */ protected void setDocumentToRepairers(IDocument document) { if (fRepairers != null) { Iterator<IPresentationRepairer> e= fRepairers.values().iterator(); while (e.hasNext()) { IPresentationRepairer repairer= e.next(); repairer.setDocument(document); } } }
IPresentationRepairer repairer= getRepairer(r.getType()); if (repairer != null) repairer.createPresentation(presentation, r);
/** * 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; } }
/** * Informs all registered repairers about the document on which they will work. * * @param document the document on which to work */ protected void setDocumentToRepairers(IDocument document) { if (fRepairers != null) { Iterator<IPresentationRepairer> e= fRepairers.values().iterator(); while (e.hasNext()) { IPresentationRepairer repairer= e.next(); repairer.setDocument(document); } } }