Task list filed eliminated.
1.1 --- a/o.n.tasklistapi/src/org/netbeans/modules/tasklist/client/SuggestionPerformer.java Mon Apr 26 15:37:29 2004 +0000
1.2 +++ b/o.n.tasklistapi/src/org/netbeans/modules/tasklist/client/SuggestionPerformer.java Mon Apr 26 16:33:03 2004 +0000
1.3 @@ -36,6 +36,7 @@
1.4 * you have to be able to adjust the file position if the user edits
1.5 * the document in the mean time.)
1.6 * <p>
1.7 + * Do not forget to adjust suggestion (in)validity.
1.8 *
1.9 * @param suggestion The suggestion to be performed
1.10 */
2.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/FixAction.java Mon Apr 26 15:37:29 2004 +0000
2.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/FixAction.java Mon Apr 26 16:33:03 2004 +0000
2.3 @@ -224,7 +224,6 @@
2.4 fixingStarted = true;
2.5 manager.setFixing(true);
2.6 }
2.7 - SuggestionList sList = (SuggestionList)item.getList();
2.8 if (item.isZombie()) {
2.9 // It looks like this item has already been removed. This
2.10 // is due to a race condition, where you double click on
2.11 @@ -257,7 +256,7 @@
2.12 // - have the same details
2.13 //
2.14 int matches = 0;
2.15 - Iterator it = sList.getRoot().subtasksIterator();
2.16 + Iterator it = item.getParent().subtasksIterator();
2.17 SuggestionImpl match = null;
2.18 boolean exact = false;
2.19 while (it.hasNext()) {
2.20 @@ -311,10 +310,11 @@
2.21 }
2.22 performer.perform(item);
2.23
2.24 - // Remove suggestion when we've performed it
2.25 - List itemList = new ArrayList(1);
2.26 - itemList.add(item);
2.27 - manager.register(item.getSType().getName(), null, itemList, sList, true);
2.28 + // XXX Remove suggestion when we've performed it
2.29 + // INSTED action is reponsible for marking suggestion as invalid
2.30 +// List itemList = new ArrayList(1);
2.31 +// itemList.add(item);
2.32 +// manager.register(item.getSType().getName(), null, itemList, sList, true);
2.33 }
2.34 } finally {
2.35 if (fixingStarted) {
3.1 --- a/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/BugList.java Mon Apr 26 15:37:29 2004 +0000
3.2 +++ b/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/BugList.java Mon Apr 26 16:33:03 2004 +0000
3.3 @@ -74,8 +74,7 @@
3.4 root = new Bug(NbBundle.getMessage(BugList.class,
3.5 "Summary"), "", 0, // NOI18N
3.6 "", "", "", null, "", "", "", "", "", 0); // NOI18N
3.7 - root.setList(this);
3.8 - }
3.9 + }
3.10 return root;
3.11 }
3.12
4.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java Mon Apr 26 15:37:29 2004 +0000
4.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java Mon Apr 26 16:33:03 2004 +0000
4.3 @@ -43,12 +43,10 @@
4.4 /**
4.5 * Some of this items attributes (such as its description - anything
4.6 * except the subtask list) has changed
4.7 + *
4.8 + * @deprecated Suggestion provides specialized properties
4.9 */
4.10 - public static final String PROP_ATTRS_CHANGED = "attrs"; // NOI18N
4.11 -
4.12 -
4.13 - /** @deprecated it forces cloning */
4.14 - private ObservableList list;
4.15 + static final String PROP_ATTRS_CHANGED = "attrs"; // NOI18N
4.16
4.17 /** Set<TaskListener> */ // replacement for above attribute
4.18 private Set listeners = new HashSet(2);
4.19 @@ -77,7 +75,6 @@
4.20 public Task() {
4.21 super(null, null, null);
4.22 parent = null;
4.23 - list = null;
4.24 visitable = true;
4.25 key = new Object();
4.26 }
4.27 @@ -85,7 +82,6 @@
4.28 public Task(String desc, Task parent) {
4.29 super(null, desc, null);
4.30 this.parent = parent;
4.31 - list = null;
4.32 visitable = true;
4.33 key = new Object();
4.34 }
4.35 @@ -323,7 +319,6 @@
4.36 }
4.37 int pos = subtasks.indexOf(after);
4.38 subtasks.add(pos+1, subtask);
4.39 - subtask.list = list;
4.40 fireAddedTask(subtask);
4.41 }
4.42
4.43 @@ -339,8 +334,6 @@
4.44 subtasks = new LinkedList();
4.45 }
4.46 subtasks.add(position, subtask);
4.47 - subtask.list = list;
4.48 -
4.49 fireAddedTask(subtask);
4.50 }
4.51
4.52 @@ -357,7 +350,6 @@
4.53 ListIterator it = tasks.listIterator();
4.54 while (it.hasNext()) {
4.55 Task task = (Task)it.next();
4.56 - task.list = list;
4.57 task.parent = this;
4.58 }
4.59
4.60 @@ -381,7 +373,6 @@
4.61 * of the beginning.
4.62 */
4.63 public void addSubtask(Task subtask, boolean append) {
4.64 - subtask.list = list;
4.65 subtask.parent = this;
4.66 if (subtasks == null) {
4.67 subtasks = new LinkedList();
4.68 @@ -435,6 +426,18 @@
4.69 return parent;
4.70 }
4.71
4.72 +
4.73 + /** Traverse to root task (or self)*/
4.74 + public final Task getRoot() {
4.75 + Task parent = getParent();
4.76 + if (parent != null) {
4.77 + return parent.getRoot();
4.78 + } else {
4.79 + return this;
4.80 + }
4.81 + }
4.82 +
4.83 +
4.84 /** Determines whether given task lies in this context. */
4.85 public final boolean isParentOf(Task task) {
4.86 if (task.getKey() == getKey()) return true;
4.87 @@ -550,22 +553,6 @@
4.88 }
4.89
4.90 /**
4.91 - * Set the list this task is contained in.
4.92 - * @deprecated Task should not have knowledge of its list
4.93 - */
4.94 - public void setList(ObservableList list) { // XXX remove publicness
4.95 - this.list = list;
4.96 - }
4.97 -
4.98 - /**
4.99 - * Get the list this task is contained in.
4.100 - * @deprecated Task should not have knowledge of its list, list have know of its members
4.101 - */
4.102 - public ObservableList getList() {
4.103 - return list;
4.104 - }
4.105 -
4.106 - /**
4.107 * Counts all subtasks of this task recursively.
4.108 *
4.109 * @return number of subtasks
4.110 @@ -606,7 +593,6 @@
4.111 */
4.112 public Task cloneTask() {
4.113 Task clone = (Task) clone();
4.114 - clone.list = null;
4.115 clone.parent = null;
4.116 return clone;
4.117 }
4.118 @@ -640,7 +626,6 @@
4.119 But the list of subitems should be unique. You get the idea.
4.120 */
4.121 protected void copyFrom(Task from) {
4.122 - list = from.list;
4.123 visitable = from.visitable;
4.124 zombie = from.zombie;
4.125
5.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java Mon Apr 26 15:37:29 2004 +0000
5.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java Mon Apr 26 16:33:03 2004 +0000
5.3 @@ -57,7 +57,6 @@
5.4 /** Creates a new instance of TaskList with a specified root */
5.5 public TaskList(Task root) { // Must this be public?
5.6 this.root = root;
5.7 - root.setList(this);
5.8 root.addTaskListener(this);
5.9 }
5.10
5.11 @@ -83,7 +82,6 @@
5.12 root.setSummary(NbBundle.getMessage(TaskList.class,
5.13 "Description")); // NOI18N
5.14 root.addTaskListener(this);
5.15 - root.setList(this); // TODO why does task know about its list?
5.16 }
5.17 return root;
5.18 }
6.1 --- a/tasklist.core/test/unit/src/org/netbeans/modules/tasklist/core/TaskTest.java Mon Apr 26 15:37:29 2004 +0000
6.2 +++ b/tasklist.core/test/unit/src/org/netbeans/modules/tasklist/core/TaskTest.java Mon Apr 26 16:33:03 2004 +0000
6.3 @@ -157,7 +157,7 @@
6.4 final Task c2 = new Task("Child 2", null);
6.5
6.6 ObservableList list = new TaskList();
6.7 - task.setList(list);
6.8 + task = list.getRoot();
6.9
6.10 final boolean tlCallbacks[] = new boolean[2];
6.11
6.12 @@ -207,14 +207,15 @@
6.13 public void testAddSubtasks() {
6.14 System.out.println("testAddSubtasks");
6.15
6.16 - final Task task = new Task("Root", null);
6.17 + Task task = new Task("Root", null);
6.18 final Task c1 = new Task("Child 1", null);
6.19 final Task c2 = new Task("Child 2", null);
6.20
6.21 ObservableList list = new TaskList();
6.22 - task.setList(list);
6.23 + task = list.getRoot();
6.24 + final Task root = task;
6.25
6.26 - final boolean tlCallbacks[] = new boolean[2];
6.27 + final boolean tlCallbacks[] = new boolean[2];
6.28 list.addTaskListener(new TaskListener() {
6.29 public void selectedTask(Task t) {
6.30 System.out.println("selectedTask:" + t);
6.31 @@ -235,7 +236,7 @@
6.32
6.33 public void structureChanged(Task t) {
6.34 System.out.println("structureChangedTask:" + t);
6.35 - if (t == task) tlCallbacks[0] = true;
6.36 + if (t == root) tlCallbacks[0] = true;
6.37 }
6.38 });
6.39
6.40 @@ -266,7 +267,7 @@
6.41 final Task c2 = new Task("Child 2", null);
6.42
6.43 ObservableList list = new TaskList();
6.44 - task.setList(list);
6.45 + task.getRoot();
6.46
6.47 List l = new ArrayList();
6.48 l.add(c1);
7.1 --- a/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/FilteredTasksList.java Mon Apr 26 15:37:29 2004 +0000
7.2 +++ b/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/FilteredTasksList.java Mon Apr 26 16:33:03 2004 +0000
7.3 @@ -59,7 +59,6 @@
7.4 public Task getRoot() {
7.5 if (root == null) {
7.6 root = new Task(); // see identity trick in fireStructureChanged
7.7 - root.setList(this);
7.8 refreshSnapshot();
7.9 }
7.10 return root;
8.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/EditTaskPanel.java Mon Apr 26 15:37:29 2004 +0000
8.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/EditTaskPanel.java Mon Apr 26 16:33:03 2004 +0000
8.3 @@ -197,7 +197,7 @@
8.4 setDueDate(item.getDueDate());
8.5
8.6 // Initialize the Categories list
8.7 - String[] categories = ((UserTaskList) item.getList()).getCategories();
8.8 + String[] categories = UserTaskList.getCategories(item);
8.9 if (categories.length > 0) {
8.10 DefaultComboBoxModel model = new DefaultComboBoxModel(categories);
8.11 categoryCombo.setModel(model);