1 19 20 package org.netbeans.core.projects; 21 22 import org.netbeans.beaninfo.editors.ListImageEditor; 23 import org.openide.util.NbBundle; 24 import org.openide.nodes.Node; 25 import org.openide.explorer.propertysheet.PropertyEnv; 26 27 import java.lang.reflect.InvocationTargetException ; 28 29 import org.netbeans.core.projects.SettingChildren.FileStateProperty; 30 31 35 class FileStateEditor extends ListImageEditor { 36 37 private String action_define = null; 38 private String action_revert = null; 39 private String action_delete = null; 40 41 private Node.Property prop = null; 42 43 44 public FileStateEditor () { 45 super (); 46 47 action_define = NbBundle.getMessage (FileStateEditor.class, "LBL_action_define"); 48 action_revert = NbBundle.getMessage (FileStateEditor.class, "LBL_action_revert"); 49 action_delete = NbBundle.getMessage (FileStateEditor.class, "LBL_action_delete"); 50 } 51 52 public void attachEnv (PropertyEnv env) { 53 super.attachEnv (env); 54 55 try { 56 prop = (Node.Property)env.getFeatureDescriptor (); 57 } catch (ClassCastException cce) { 58 ClassCastException cce2 = new ClassCastException ("Expected a Node.Property but got a " + env.getFeatureDescriptor() + " descriptor " + env.getFeatureDescriptor().getClass().getName()); 59 throw cce2; 60 } 61 } 62 63 public String getAsText () { 64 return null; 65 } 66 67 public void setAsText (String str) throws java.lang.IllegalArgumentException { 68 try { 69 Integer value = null; 70 if (action_define.equals (str)) { 71 value = Integer.valueOf (SettingChildren.FileStateProperty.ACTION_DEFINE); 72 } 73 if (action_revert.equals (str)) { 74 value = Integer.valueOf (FileStateProperty.ACTION_REVERT); 75 } 76 if (action_delete.equals (str)) { 77 value = Integer.valueOf (FileStateProperty.ACTION_DELETE); 78 } 79 if (value != null) { 80 prop.setValue (value); 81 super.setValue(value); 82 } 83 } catch (IllegalAccessException e) { 84 } catch (InvocationTargetException e) { 85 } 86 } 87 88 public String [] getTags () { 89 Integer val = (Integer ) getValue (); 90 91 if (SettingChildren.PROP_LAYER_MODULES.equals (prop.getName ())) { 92 return new String [] { 93 action_revert 94 }; 95 } 96 if (val != null && 97 val.intValue () == FileStateManager.FSTATE_IGNORED) { 98 return new String [] { 99 action_define, 100 action_revert, 101 action_delete 102 }; 103 } 104 return new String [] { 105 action_define 106 }; 107 } 108 } 109 | Popular Tags |