1 19 20 package org.netbeans.modules.tasklist.suggestions; 21 22 import java.awt.Image ; 23 import java.awt.Toolkit ; 24 import java.net.URL ; 25 import java.util.ResourceBundle ; 26 import org.openide.util.NbBundle; 27 import java.util.List ; 28 29 35 36 final public class SuggestionType { 37 38 46 SuggestionType(String name, String bundle, String key, 47 String longkey, URL icon, List actions) { 48 this.name = name; 49 this.bundle = bundle; 50 this.key = key; 51 this.longkey = longkey; 52 this.icon = icon; 53 this.actions = actions; 54 } 55 56 List getActions() { 57 return actions; 58 } 59 60 61 public String getName() { 62 return name; 63 } 64 65 66 String getBundle() { 67 return bundle; 68 } 69 70 71 String getKey() { 72 return key; 73 } 74 75 76 URL getIcon() { 77 return icon; 78 } 79 80 81 public Image getIconImage() { 82 if ((img == null) && (icon != null)) { 83 img = Toolkit.getDefaultToolkit().getImage(icon); 84 } 85 return img; 86 } 87 88 89 public String getLocalizedName() { 90 if (localizedName == null) { 91 ResourceBundle rb = NbBundle.getBundle(bundle); 92 localizedName = rb.getString(key); 93 if (localizedName == null) { 94 localizedName = ""; 95 } 96 } 97 return localizedName; 98 } 99 100 101 String getDescription() { 102 if (localizedDesc == null) { 103 if (longkey != null) { 104 ResourceBundle rb = NbBundle.getBundle(bundle); 105 localizedDesc = rb.getString(longkey); 106 } 107 if (localizedDesc == null) { 108 localizedDesc = ""; 109 } 110 } 111 return localizedDesc; 112 } 113 114 116 public String toString() { 117 return "SuggestionType[name=" + name + ",bundle=" + bundle + ",key=" + key + ",icon=" + icon + ",pos=" + position +"]"; } 120 121 122 public void setPosition(int position) { 123 this.position = position; 124 } 125 126 127 public int getPosition() { 128 return position; 129 } 130 131 private int position; 132 private String name; 133 private String bundle; 134 private String key; 135 private String longkey; 136 private URL icon; 137 private Image img = null; 138 private String localizedName = null; 139 private String localizedDesc = null; 140 private List actions; 141 } 142 | Popular Tags |