1 19 20 package org.netbeans.modules.java.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 32 public class CodeFoldingEditor extends PropertyEditorSupport { 33 34 protected HelpCtx getHelpCtx () { 35 return HelpCtx.DEFAULT_HELP; 36 } 37 38 39 public CodeFoldingEditor() { 40 } 41 42 public boolean supportsCustomEditor() { 43 return true; 44 } 45 46 47 private CodeFoldingEditorPanel editorPanel; 48 49 52 public java.awt.Component getCustomEditor() { 53 if( editorPanel == null ) { 54 editorPanel = new CodeFoldingEditorPanel( this ); 55 HelpCtx.setHelpIDString( editorPanel, getHelpCtx().getHelpID() ); 56 refreshEditorPanel(); 57 } 58 return editorPanel; 59 } 60 61 private void refreshEditorPanel() { 62 if( editorPanel != null ) { 63 editorPanel.setValue( (Map )getValue() ); 64 } 65 } 66 67 70 public void setValue( Object obj ) { 71 Object oldValue = getValue(); 72 if( (obj != null) && (! obj.equals( oldValue ) ) ) { 73 super.setValue( obj ); 74 if( ( editorPanel != null ) && (! editorPanel.getValue().equals( getValue() ) ) ) { 75 refreshEditorPanel(); 76 } 77 } 78 } 79 80 83 protected void customEditorChange() { 84 super.setValue( new HashMap ( editorPanel.getValue() ) ); 86 } 87 88 91 public String getAsText() { 92 return NbBundle.getBundle( CodeFoldingEditor.class ).getString( "PROP_CodeFolding" ); } 94 95 98 public void setAsText( String s ) { 99 } 100 101 102 } 103 104 | Popular Tags |