1 package org.netbeans.modules.tasklist.javadoc; 2 3 import java.util.Iterator ; 4 import java.util.List ; 5 import org.netbeans.modules.tasklist.client.Suggestion; 6 import org.netbeans.modules.tasklist.client.SuggestionPerformer; 7 import org.netbeans.modules.tasklist.core.TLUtils; 8 import org.netbeans.modules.tasklist.javadoc.ext.JavadocProxy; 9 import org.openide.ErrorManager; 10 import org.openide.loaders.DataObject; 11 import org.openide.src.SourceException; 12 import org.openide.util.NbBundle; 13 14 20 public class JavaDocSuggestionPerformer implements SuggestionPerformer { 21 private DataObject dobj; 22 private JavadocProxy.ElementProxy element; 23 24 30 public JavaDocSuggestionPerformer(JavadocProxy.ElementProxy element, 31 DataObject dobj) { 32 this.element = element; 33 this.dobj = dobj; 34 } 35 36 public boolean hasConfirmation() { 37 return true; 38 } 39 40 public Object getConfirmation(Suggestion s) { 41 String filename = dobj.getPrimaryFile().getNameExt(); 42 43 StringBuffer sb = new StringBuffer (1000); 44 sb.append("<html><body><ul>"); List resolutionList = element.getResolutionList(); 46 Iterator it = resolutionList.iterator(); 47 while (it.hasNext()) { 48 String resolution = it.next().toString(); 49 sb.append("<li>"); TLUtils.appendHTMLString(sb, resolution); 51 } 52 sb.append("</ul></body></html>"); String afterContents = sb.toString(); 54 55 String beforeDesc = NbBundle.getMessage( 56 JavaDocSuggestionPerformer.class, "ConfPanelAbove"); sb.setLength(0); 58 sb.append("<html><body><i>/** "); TLUtils.appendHTMLString( 60 sb,element.getJavaDoc().getRawText()); 61 sb.append("*/</i></body></html>"); String beforeContents = sb.toString(); 63 String afterDesc = NbBundle.getMessage( 64 DocSuggester.class, "ConfPanelBelow"); 66 return new ConfPanel(beforeDesc, beforeContents, 67 afterDesc, 68 afterContents, filename, -1); 69 70 } 71 72 public void perform(Suggestion s) { 73 element.viewSource(); try { 75 element.autoCorrect(); 76 } catch (SourceException e) { 77 ErrorManager.getDefault().notify(e); 78 } 79 } 80 }; 81 | Popular Tags |