Search in sources :

Example 1 with EditAnnotator

use of org.eclipse.jdt.internal.ui.text.correction.proposals.EditAnnotator in project flux by eclipse.

the class CUCorrectionProposal method getAdditionalProposalInfo.

@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
    StringBuffer buf = new StringBuffer();
    try {
        TextChange change = getTextChange();
        change.setKeepPreviewEdits(true);
        IDocument previewDocument = change.getPreviewDocument(monitor);
        TextEdit rootEdit = change.getPreviewEdit(change.getEdit());
        EditAnnotator ea = new EditAnnotator(buf, previewDocument);
        rootEdit.accept(ea);
        // Final pre-existing region
        ea.unchangedUntil(previewDocument.getLength());
    } catch (CoreException e) {
        JavaPlugin.log(e);
    }
    return buf.toString();
}
Also used : EditAnnotator(org.eclipse.jdt.internal.ui.text.correction.proposals.EditAnnotator) CoreException(org.eclipse.core.runtime.CoreException) MultiTextEdit(org.eclipse.text.edits.MultiTextEdit) TextEdit(org.eclipse.text.edits.TextEdit) TextChange(org.eclipse.ltk.core.refactoring.TextChange) IDocument(org.eclipse.jface.text.IDocument)

Example 2 with EditAnnotator

use of org.eclipse.jdt.internal.ui.text.correction.proposals.EditAnnotator in project che by eclipse.

the class CUCorrectionProposal method getAdditionalProposalInfo.

@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
    StringBuffer buf = new StringBuffer();
    try {
        TextChange change = getTextChange();
        change.setKeepPreviewEdits(true);
        IDocument previewDocument = change.getPreviewDocument(monitor);
        TextEdit rootEdit = change.getPreviewEdit(change.getEdit());
        EditAnnotator ea = new EditAnnotator(buf, previewDocument);
        rootEdit.accept(ea);
        // Final pre-existing region
        ea.unchangedUntil(previewDocument.getLength());
    } catch (CoreException e) {
        JavaPlugin.log(e);
    }
    return buf.toString();
}
Also used : EditAnnotator(org.eclipse.jdt.internal.ui.text.correction.proposals.EditAnnotator) CoreException(org.eclipse.core.runtime.CoreException) MultiTextEdit(org.eclipse.text.edits.MultiTextEdit) TextEdit(org.eclipse.text.edits.TextEdit) TextChange(org.eclipse.ltk.core.refactoring.TextChange) IDocument(org.eclipse.jface.text.IDocument)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)2 EditAnnotator (org.eclipse.jdt.internal.ui.text.correction.proposals.EditAnnotator)2 IDocument (org.eclipse.jface.text.IDocument)2 TextChange (org.eclipse.ltk.core.refactoring.TextChange)2 MultiTextEdit (org.eclipse.text.edits.MultiTextEdit)2 TextEdit (org.eclipse.text.edits.TextEdit)2