1 11 12 package org.eclipse.jdt.internal.ui.text.correction; 13 14 import org.eclipse.text.edits.ReplaceEdit; 15 import org.eclipse.text.edits.TextEdit; 16 17 import org.eclipse.core.runtime.CoreException; 18 19 import org.eclipse.jface.text.IDocument; 20 21 import org.eclipse.jdt.core.ICompilationUnit; 22 23 import org.eclipse.jdt.internal.ui.JavaPluginImages; 24 25 public class ReplaceCorrectionProposal extends CUCorrectionProposal { 26 27 private String fReplacementString; 28 private int fOffset; 29 private int fLength; 30 31 public ReplaceCorrectionProposal(String name, ICompilationUnit cu, int offset, int length, String replacementString, int relevance) { 32 super(name, cu, relevance, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)); 33 fReplacementString= replacementString; 34 fOffset= offset; 35 fLength= length; 36 } 37 38 41 protected void addEdits(IDocument doc, TextEdit rootEdit) throws CoreException { 42 super.addEdits(doc, rootEdit); 43 44 TextEdit edit= new ReplaceEdit(fOffset, fLength, fReplacementString); 45 rootEdit.addChild(edit); 46 } 47 48 } 49 | Popular Tags |