1 19 package org.netbeans.modules.xml.core.settings; 20 21 import java.beans.*; 22 import java.util.*; 23 24 import org.openide.actions.*; 25 import org.openide.util.actions.*; 26 27 32 public final class DefaultActionPropertyEditor extends PropertyEditorSupport { 33 34 35 private static Map name2class = new TreeMap(); 36 37 static { 38 String dname, cname; 39 dname = SystemAction.get(EditAction.class).getName(); 40 cname = EditAction.class.getName(); 41 name2class.put(dname, cname); 42 43 dname = SystemAction.get(OpenAction.class).getName(); 44 cname = OpenAction.class.getName(); 45 name2class.put(dname, cname); 46 47 51 dname = SystemAction.get(ViewAction.class).getName(); 52 cname = ViewAction.class.getName(); 53 name2class.put(dname, cname); 54 55 58 } 59 60 61 public DefaultActionPropertyEditor() { 62 } 63 64 67 public String [] getTags() { 68 Set names = name2class.keySet(); 69 return (String []) names.toArray(new String [names.size()]); 70 } 71 72 public void setAsText(String action) { 73 String klass = (String ) name2class.get(action); 74 if (klass != null) { 75 setValue(klass); 76 } else { 77 setValue(null); } 80 } 81 82 85 public String getAsText() { 86 String className = (String ) getValue(); 87 if (className == null) { 88 return Util.THIS.getString("PROP_system_default_action"); 89 } else { 90 Iterator it = name2class.keySet().iterator(); 91 while (it.hasNext()) { 92 String key = (String ) it.next(); 93 String next = (String ) name2class.get(key); 94 if (next == null) continue; 95 if (next.equals(className)) return key; 96 } 97 return className; } 99 } 100 101 public boolean supportsEditingTaggedValues () { 102 return false; 103 } 104 105 public boolean hasInPlaceCustomEditor () { 106 return false; 107 } 108 109 public boolean isPaintable() { 110 return false; 111 } 112 } 113 | Popular Tags |