1 19 20 package org.netbeans.modules.retouche.editor.options; 21 22 import java.beans.PropertyEditorSupport ; 23 import java.util.HashMap ; 24 import java.util.Map ; 25 import org.openide.util.HelpCtx; 26 import org.openide.util.NbBundle; 27 28 37 public class CodeFoldingEditor extends PropertyEditorSupport { 38 39 protected HelpCtx getHelpCtx () { 40 return HelpCtx.DEFAULT_HELP; 41 } 42 43 44 public CodeFoldingEditor() { 45 } 46 47 public boolean supportsCustomEditor() { 48 return true; 49 } 50 51 52 private CodeFoldingEditorPanel editorPanel; 53 54 57 public java.awt.Component getCustomEditor() { 58 if( editorPanel == null ) { 59 editorPanel = new CodeFoldingEditorPanel( this ); 60 HelpCtx.setHelpIDString( editorPanel, getHelpCtx().getHelpID() ); 61 refreshEditorPanel(); 62 } 63 return editorPanel; 64 } 65 66 private void refreshEditorPanel() { 67 if( editorPanel != null ) { 68 editorPanel.setValue( (Map )getValue() ); 69 } 70 } 71 72 75 public void setValue( Object obj ) { 76 Object oldValue = getValue(); 77 if( (obj != null) && (! obj.equals( oldValue ) ) ) { 78 super.setValue( obj ); 79 if( ( editorPanel != null ) && (! editorPanel.getValue().equals( getValue() ) ) ) { 80 refreshEditorPanel(); 81 } 82 } 83 } 84 85 88 protected void customEditorChange() { 89 super.setValue( new HashMap ( editorPanel.getValue() ) ); 91 } 92 93 96 public String getAsText() { 97 return NbBundle.getBundle( CodeFoldingEditor.class ).getString( "PROP_CodeFolding" ); } 99 100 103 public void setAsText( String s ) { 104 } 105 106 107 } 108 109 | Popular Tags |