1 19 20 package org.netbeans.modules.javadoc.comments; 21 22 import java.awt.*; 23 import java.beans.*; 24 import org.openide.util.NbBundle; 25 import org.openide.src.JavaDoc; 26 27 32 public final class JavaDocEditor extends PropertyEditorSupport { 33 34 36 private AutoCommenter.Element element; 37 38 40 private JavaDocEditorPanel editorPanel = null; 41 42 43 44 46 public JavaDocEditor(AutoCommenter.Element element) { 47 if (element == null) throw new NullPointerException ("element"); this.element = element; 49 } 50 51 53 public void setValue (Object object) { 54 if (!(object instanceof JavaDoc)) 55 throw new IllegalArgumentException ("object: " + object); 57 super.setValue(object); 58 } 59 60 public String getAsText () { 61 JavaDoc jd = (JavaDoc) getValue(); 62 String v = jd.getRawText(); 63 if (v == null) { 64 return ResourceUtils.getBundledString("MSG_javadocCommentValue"); } else { 66 return jd.getText(); 67 } 68 } 69 70 public void setAsText (String string) { 71 return; 72 } 73 74 public String getJavaInitializationString () { 75 return null; 76 } 77 78 public String [] getTags () { 79 return null; 80 } 81 82 public boolean isPaintable () { 83 return false; 84 } 85 86 public void paintValue (Graphics g, Rectangle rectangle) { 87 } 88 89 public boolean supportsCustomEditor () { 90 return true; 91 } 92 93 public Component getCustomEditor () { 94 if (editorPanel == null) { 95 editorPanel = new JavaDocEditorPanel(element, (JavaDoc) getValue()); 96 editorPanel.getAccessibleContext().setAccessibleName(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yName")); editorPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yDesc")); } 99 return editorPanel; 100 } 101 102 } 103 | Popular Tags |