1 19 20 package org.netbeans.modules.editor.options; 21 22 import java.beans.*; 23 import java.util.*; 24 import javax.swing.event.*; 25 26 import org.openide.util.HelpCtx; 27 import org.openide.util.NbBundle; 28 29 34 35 public class AbbrevsEditor extends PropertyEditorSupport { 36 37 private AbbrevsEditorPanel editorPanel; 38 39 private static final String HELP_ID = "editing.abbreviations"; 41 protected HelpCtx getHelpCtx () { 42 return new HelpCtx (HELP_ID); 43 } 44 45 48 public boolean supportsCustomEditor() { 49 return true; 50 } 51 52 55 public java.awt.Component getCustomEditor() { 56 if( editorPanel == null ) { 57 editorPanel = new AbbrevsEditorPanel( this ); 58 HelpCtx.setHelpIDString( editorPanel, getHelpCtx().getHelpID() ); 59 refreshEditorPanel(); 60 } 61 return editorPanel; 62 } 63 64 private void refreshEditorPanel() { 65 if( editorPanel != null ) { 66 editorPanel.setValue( (Map)getValue() ); 67 } 68 } 69 70 73 public void setValue( Object obj ) { 74 Object oldValue = getValue(); 75 if( (obj != null) && (! obj.equals( oldValue ) ) ) { 76 super.setValue( obj ); 77 if( ( editorPanel != null ) && (! editorPanel.getValue().equals( getValue() ) ) ) { 78 refreshEditorPanel(); 79 } 80 } 81 } 82 83 86 protected void customEditorChange() { 87 super.setValue( new HashMap( editorPanel.getValue() ) ); 89 } 90 91 94 public String getAsText() { 95 return NbBundle.getBundle( KeyBindingsEditor.class ).getString( "PROP_Abbreviations" ); } 97 98 101 public void setAsText( String s ) { 102 } 103 104 } 105 | Popular Tags |