1 19 20 package org.netbeans.modules.tasklist.bugs; 21 22 import java.util.List ; 23 import java.util.Iterator ; 24 25 import org.netbeans.modules.tasklist.core.filter.FilterAction; 26 import org.netbeans.modules.tasklist.core.TaskNode; 27 import org.netbeans.modules.tasklist.core.TaskListView; 28 import org.openide.ErrorManager; 29 import org.openide.actions.PropertiesAction; 30 import org.openide.nodes.Node; 31 import org.openide.nodes.Sheet; 32 33 import org.openide.nodes.Node.Property; 34 import org.openide.nodes.PropertySupport.Reflection; 35 import org.openide.nodes.Sheet.Set; 36 import org.openide.util.NbBundle; 37 import org.openide.util.actions.SystemAction; 38 import org.netbeans.modules.tasklist.core.TaskChildren; 39 import org.netbeans.modules.tasklist.core.Task; 40 import org.openide.nodes.Children; 41 42 import javax.swing.*; 43 import org.netbeans.modules.tasklist.core.export.ExportAction; 44 45 46 class BugNode extends TaskNode { 47 48 BugNode(Bug item) { 50 super(item); 51 init(); 52 } 53 54 BugNode(Bug item, Children children) { 56 super(item, children); 57 init(); 58 } 59 60 protected TaskChildren createChildren() { 61 return new BugChildren((Bug)this.item); 62 } 63 64 65 static class BugChildren extends TaskChildren { 67 68 BugChildren(Bug parent) { super(parent);} 69 70 protected TaskNode createNode(Task task) { 71 return new BugNode((Bug)task); 72 } 73 } 74 75 private void init() { 76 setDefaultAction(SystemAction.get(ViewBugAction.class)); 77 setIconBase("org/netbeans/modules/tasklist/bugs/bug"); } 79 80 public Node cloneNode () { 82 return new BugNode((Bug)item); 83 } 84 85 protected void updateIcon() { 86 } 88 89 protected SystemAction[] createActions() { 90 91 97 99 100 return new SystemAction[] { 101 SystemAction.get(NewQueryAction.class), 102 null, 103 SystemAction.get(ViewBugAction.class), 104 null, 105 SystemAction.get(RefreshAction.class), 106 null, 107 SystemAction.get(FilterAction.class), 108 null, 109 117 SystemAction.get(ExportAction.class), 118 null, 119 SystemAction.get(PropertiesAction.class), 120 }; 121 } 122 123 public Action[] getActions(boolean empty) { 124 if (empty) { 125 return new SystemAction[] { 126 SystemAction.get(NewQueryAction.class), 127 }; 128 } else { 129 return super.getActions(false); 130 } 131 } 132 133 135 protected Sheet createSheet() { 136 Sheet s = Sheet.createDefault(); 137 Set ss = s.get(Sheet.PROPERTIES); 138 139 try { 140 Property p; 141 p = new Reflection(item, String .class, "getSummary", null); p.setName(TaskListView.PROP_TASK_SUMMARY); 143 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Summary")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "SummaryHint")); ss.put(p); 146 147 p = new Reflection(item, String .class, "getId", null); p.setName(BugsView.PROP_BUG_ID); 149 p.setDisplayName(NbBundle.getMessage(BugNode.class, "BugId")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "BugIdHint")); ss.put(p); 152 153 p = new Reflection(item, String .class, "getSynopsis", null); p.setName(BugsView.PROP_BUG_SYNOPSIS); 155 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Synopsis")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "SynopsisHint")); ss.put(p); 158 159 p = new Reflection(item, Integer.TYPE, "getPriorityNumber", null); p.setName(BugsView.PROP_BUG_PRIO); 161 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Priority")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "PriorityHint")); ss.put(p); 164 165 166 167 168 169 170 p = new Reflection(item, String .class, "getType", null); p.setName(BugsView.PROP_BUG_TYPE); 172 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Type")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "TypeHint")); ss.put(p); 175 176 177 178 179 p = new Reflection(item, String .class, "getComponent", null); p.setName(BugsView.PROP_BUG_COMP); 181 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Component")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "ComponentHint")); ss.put(p); 184 185 186 187 188 p = new Reflection(item, String .class, "getSubComponent", null); p.setName(BugsView.PROP_BUG_SUBCOMP); 190 p.setDisplayName(NbBundle.getMessage(BugNode.class, "SubComponent")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "SubComponentHint")); ss.put(p); 193 194 195 196 197 p = new Reflection(item, String .class, "getCreated", null); p.setName(BugsView.PROP_BUG_CREATED); 199 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Created")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "CreatedHint")); ss.put(p); 202 203 204 205 206 p = new Reflection(item, String .class, "getKeywords", null); p.setName(BugsView.PROP_BUG_KEYWORDS); 208 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Keywords")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "KeywordsHint")); ss.put(p); 211 212 213 214 215 p = new Reflection(item, String .class, "getAssignedTo", null); p.setName(BugsView.PROP_BUG_ASSIGNED); 217 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Assigned")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "AssignedHint")); ss.put(p); 220 221 222 223 224 p = new Reflection(item, String .class, "getReportedBy", null); p.setName(BugsView.PROP_BUG_REPORTEDBY); 226 p.setDisplayName(NbBundle.getMessage(BugNode.class, "ReportedBy")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "ReportedByHint")); ss.put(p); 229 230 231 p = new Reflection(item, String .class, "getStatus", null); p.setName(BugsView.PROP_BUG_STATUS); 233 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Status")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "StatusHint")); ss.put(p); 236 237 238 p = new Reflection(item, String .class, "getTarget", null); p.setName(BugsView.PROP_BUG_TARGET); 240 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Target")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "TargetHint")); ss.put(p); 243 244 245 246 p = new Reflection(item, Integer.TYPE, "getVotes", null); p.setName(BugsView.PROP_BUG_VOTES); 248 p.setDisplayName(NbBundle.getMessage(BugNode.class, "Votes")); p.setShortDescription(NbBundle.getMessage(BugNode.class, "VotesHint")); ss.put(p); 251 252 253 254 255 } catch (NoSuchMethodException nsme) { 256 ErrorManager.getDefault().notify(nsme); 257 } 258 return s; 259 } 260 261 public boolean canRename() { 262 return false; 263 } 264 265 public boolean canDestroy() { 266 return false; 267 } 268 269 public boolean canCopy () { 270 return false; 271 } 272 273 public boolean canCut () { 274 return false; 275 } 276 } 277 278 | Popular Tags |