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 35 36 public class MacrosEditor extends PropertyEditorSupport { 37 38 private MacrosEditorPanel editorPanel; 39 40 private static final String HELP_ID = "editing.macros.editing"; 42 protected HelpCtx getHelpCtx () { 43 return new HelpCtx (HELP_ID); 44 } 45 46 49 public boolean supportsCustomEditor() { 50 return true; 51 } 52 53 56 public java.awt.Component getCustomEditor() { 57 if( editorPanel == null ) { 58 editorPanel = new MacrosEditorPanel( this ); 59 HelpCtx.setHelpIDString( editorPanel, getHelpCtx().getHelpID() ); 60 refreshEditorPanel(); 61 } 62 return editorPanel; 63 } 64 65 private void refreshEditorPanel() { 66 if( editorPanel != null ) { 67 editorPanel.setValue( (Map)getValue() ); 68 } 69 } 70 71 74 public void setValue( Object obj ) { 75 Object oldValue = getValue(); 76 if( (obj != null) && (! obj.equals( oldValue ) ) ) { 77 super.setValue( obj ); 78 if( ( editorPanel != null ) && (! editorPanel.getValue().equals( getValue() ) ) ) { 79 refreshEditorPanel(); 80 } 81 } 82 } 83 84 87 protected void customEditorChange() { 88 super.setValue( new HashMap( editorPanel.getValue() ) ); 90 } 91 92 95 public String getAsText() { 96 return NbBundle.getBundle( KeyBindingsEditor.class ).getString( "PROP_Macros" ); } 98 99 102 public void setAsText( String s ) { 103 } 104 105 } 106 | Popular Tags |