1 9 10 package org.netbeans.modules.tasklist.checkstyle; 11 12 13 import javax.swing.text.BadLocationException ; 14 import javax.swing.text.Document ; 15 import javax.swing.text.Element ; 16 17 import org.netbeans.modules.tasklist.client.Suggestion; 18 19 import org.openide.ErrorManager; 20 21 25 public final class DeleteLineSuggestionPerformer extends AbstractSuggestionPerformer{ 26 27 28 DeleteLineSuggestionPerformer( 29 final Document doc, 30 final int lineno) { 31 32 super(doc,lineno,-1); 33 } 34 35 public void perform(final Suggestion suggestion) { 36 37 super.perform(suggestion); 39 40 final Element elm = getElement(doc, lineno-1); 41 if (elm == null) { 42 ErrorManager.getDefault().log(ErrorManager.USER, "getElement was null"); 43 return; 44 } 45 final int offset = elm.getStartOffset(); 46 final int endOffset = elm.getEndOffset(); 47 try { 48 doc.remove(offset,endOffset-offset); 49 } catch (BadLocationException ex) { 50 ErrorManager.getDefault().notify(ErrorManager.WARNING, ex); 51 } 52 } 53 54 57 public Object getConfirmation(final Suggestion suggestion) { 58 return null; 59 } 60 61 public boolean hasConfirmation() { 62 return false; 63 } 64 65 protected void performImpl(int docPosition) throws BadLocationException { 66 } 67 68 } 69 | Popular Tags |