1 19 20 package org.netbeans.modules.tasklist.i18n; 21 22 import javax.swing.text.BadLocationException ; 23 import javax.swing.text.Document ; 24 import org.netbeans.modules.tasklist.client.SuggestionPerformer; 25 import org.netbeans.modules.tasklist.core.TLUtils; 26 import org.openide.ErrorManager; 27 import org.openide.text.Line; 28 import org.openide.util.NbBundle; 29 30 35 public class AddI18NCommentPerformer implements SuggestionPerformer { 36 39 public AddI18NCommentPerformer() { 40 } 41 42 public Object getConfirmation(org.netbeans.modules.tasklist.client.Suggestion suggestion) { 43 return NbBundle.getMessage(AddI18NCommentPerformer.class, "Confirmation"); } 45 46 public void perform(org.netbeans.modules.tasklist.client.Suggestion suggestion) { 47 Line line = suggestion.getLine(); 48 49 Document doc = TLUtils.getDocument(line); 50 if (doc == null) 51 return; 52 53 javax.swing.text.Element el = TLUtils.getElement(doc, line); 54 if (el == null) 55 return; 56 57 try { 58 doc.insertString(el.getEndOffset() - 1, " // NOI18N", null); } catch (BadLocationException ex) { 60 ErrorManager.getDefault().notify(ErrorManager.WARNING, ex); 61 } 62 } 63 64 public boolean hasConfirmation() { 65 return true; 66 } 67 } 68 | Popular Tags |