1 11 package org.eclipse.pde.ui.templates; 12 20 public abstract class TemplateOption extends TemplateField { 21 private String name; 22 private Object value; 23 private boolean enabled = true; 24 private boolean required; 25 35 public TemplateOption(BaseOptionTemplateSection section, String name, 36 String label) { 37 super(section, label); 38 this.name = name; 39 } 40 45 public String getName() { 46 return name; 47 } 48 54 public void setName(String name) { 55 this.name = name; 56 } 57 62 public Object getValue() { 63 return value; 64 } 65 71 public boolean isEmpty() { 72 return false; 73 } 74 83 public void setRequired(boolean required) { 84 this.required = required; 85 } 86 92 public boolean isRequired() { 93 return required; 94 } 95 101 public void setValue(Object value) { 102 this.value = value; 103 } 104 110 public boolean isEnabled() { 111 return enabled; 112 } 113 120 public void setEnabled(boolean enabled) { 121 this.enabled = enabled; 122 } 123 128 public String getMessageLabel() { 129 String label = getLabel(); 130 StringBuffer buf = new StringBuffer (); 131 for (int i = 0; i < label.length(); i++) { 132 char c = label.charAt(i); 133 if (c == '(' && i < label.length() - 1) { 134 char c2 = label.charAt(i + 1); 135 if (c2 == '&') { 136 break; 140 } 141 } 142 if (c != '&' && c != ':') 143 buf.append(c); 144 } 145 return buf.toString(); 146 } 147 } 148 | Popular Tags |