1 19 20 package org.netbeans.modules.editor.options; 21 22 import java.awt.Component ; 23 import java.beans.*; 24 import java.util.*; 25 import javax.swing.event.*; 26 27 import org.openide.util.HelpCtx; 28 import org.openide.util.NbBundle; 29 30 37 38 public class KeyBindingsEditor extends PropertyEditorSupport { 39 40 private KeyBindingsEditorPanel editorPanel; 41 42 private static final String HELP_ID = "editing.keybindings"; 44 protected HelpCtx getHelpCtx () { 45 return new HelpCtx (HELP_ID); 46 } 47 48 51 public boolean supportsCustomEditor() { 52 return true; 53 } 54 55 58 public java.awt.Component getCustomEditor() { 59 if( editorPanel == null ) { 60 editorPanel = new KeyBindingsEditorPanel( this ); 61 HelpCtx.setHelpIDString( editorPanel, getHelpCtx().getHelpID() ); 62 } 63 refreshEditor(); 64 return editorPanel; 65 } 66 67 private void refreshEditor() { 68 if( editorPanel != null ) { 69 editorPanel.setValue( (List)getValue() ); 70 } 71 } 72 73 76 public void setValue( Object obj ) { 77 Object oldValue = getValue(); 78 if( (obj != null) && (! obj.equals( oldValue ) ) ) { 79 super.setValue( obj ); 80 if( ( editorPanel != null ) && (! editorPanel.getValue().equals( getValue() ) ) ) { 81 refreshEditor(); 82 } 83 } 84 } 85 86 87 90 protected void customEditorChange() { 91 super.setValue( editorPanel.getValue() ); 93 } 94 95 98 public String getAsText() { 99 return NbBundle.getBundle( KeyBindingsEditor.class ).getString( "PROP_KeyBindings" ); } 102 103 106 public void setAsText( String s ) { 107 } 108 109 } 110 | Popular Tags |