1.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/ShowSuggestionAction.java Sat Mar 08 20:27:53 2003 +0000
1.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/ShowSuggestionAction.java Sun Mar 09 09:25:17 2003 +0000
1.3 @@ -41,7 +41,7 @@
1.4 return; // internal error
1.5 }
1.6 SuggestionsView tlv = (SuggestionsView)v;
1.7 - tlv.show(item, new SuggestionAnno(item));
1.8 + tlv.showTask(item, new SuggestionAnno(item));
1.9 }
1.10
1.11 /** Enable the task iff you've selected exactly one node,
2.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/GoToTaskAction.java Sat Mar 08 20:27:53 2003 +0000
2.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/GoToTaskAction.java Sun Mar 09 09:25:17 2003 +0000
2.3 @@ -31,7 +31,7 @@
2.4 (Task)TaskNode.getTask(nodes[0]); // safe - see enable check
2.5 TaskListView tlv = TaskListView.getCurrent();
2.6 if (tlv != null) {
2.7 - tlv.show(item, null);
2.8 + tlv.showTask(item, null);
2.9 } else {
2.10 System.out.println("No current view!");
2.11 }
3.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java Sat Mar 08 20:27:53 2003 +0000
3.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java Sun Mar 09 09:25:17 2003 +0000
3.3 @@ -124,14 +124,11 @@
3.4 protected TaskList list;
3.5 protected boolean visitable;
3.6
3.7 -
3.8 /** When true, don't notify anybody of updates to this object - and don't
3.9 modify the edited timestamp. Used by the restore code. */
3.10 protected boolean silentUpdate = false;
3.11
3.12 protected Task parent;
3.13 -
3.14 -
3.15
3.16 /** If this item has subtasks, they are stored in this list */
3.17 protected LinkedList subtasks = null;
3.18 @@ -151,6 +148,16 @@
3.19 }
3.20
3.21 /**
3.22 + * Removes all subtasks.
3.23 + */
3.24 + public void clear() {
3.25 + if (hasSubtasks()) {
3.26 + subtasks.clear();
3.27 + updatedStructure();
3.28 + }
3.29 + }
3.30 +
3.31 + /**
3.32 * Returns indent level for this task. If parent == null returns 0
3.33 * @return indent level for this task
3.34 */
3.35 @@ -565,10 +572,6 @@
3.36 * writes out all the fields, not just the
3.37 * description. */
3.38 public static void generate(Task item, Writer w) throws IOException {
3.39 - // XXX
3.40 - // For some odd reason, my TodoTransfer's convert method never seems
3.41 - // to get called, so I haven't been able to test this, that's why
3.42 - // I haven't expanded the code as much as it should be.
3.43 w.write(item.getSummary());
3.44 }
3.45
3.46 @@ -585,14 +588,14 @@
3.47 List notes = new LinkedList(); // List<Note>
3.48 String line;
3.49 while ((line = reader.readLine()) != null) {
3.50 - // XXX For some odd reason, my TodoTransfer's convert
3.51 - // method never seems to get called, so I haven't been
3.52 + // XXX TodoTransfer's convert
3.53 + // method never seems to get called (see explanations in
3.54 + // TaskNode.clipboardCopy), so I haven't been
3.55 // able to test this, that's why I haven't expanded the
3.56 // code as much as it should be.
3.57 Task item = new Task();
3.58 item.setSummary(line);
3.59 return item;
3.60 - // XXX not done... see above
3.61 }
3.62 return null;
3.63 }
4.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java Sat Mar 08 20:27:53 2003 +0000
4.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java Sun Mar 09 09:25:17 2003 +0000
4.3 @@ -403,10 +403,7 @@
4.4 /** Remove all the tasks in this tasklist */
4.5 public void clear() {
4.6 if (root != null) {
4.7 - List list = root.getSubtasks();
4.8 - if (list != null) {
4.9 - list.clear();
4.10 - }
4.11 + root.clear();
4.12 }
4.13 }
4.14
5.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskListView.java Sat Mar 08 20:27:53 2003 +0000
5.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskListView.java Sun Mar 09 09:25:17 2003 +0000
5.3 @@ -71,6 +71,7 @@
5.4 import org.openide.actions.FindAction;
5.5 import org.openide.explorer.ExplorerPanel;
5.6 import org.openide.explorer.view.Visualizer;
5.7 +import org.openide.text.Line;
5.8 import org.openide.util.actions.ActionPerformer;
5.9 import org.openide.util.actions.SystemAction;
5.10 import org.openide.windows.Mode;
5.11 @@ -87,8 +88,9 @@
5.12 * from this class
5.13 */
5.14 public abstract class TaskListView extends ExplorerPanel
5.15 - implements TaskListener, ActionListener,
5.16 - PropertyChangeListener {
5.17 + implements TaskListener, ActionListener, PropertyChangeListener {
5.18 + /** Property "task summary" */
5.19 + public static final String PROP_TASK_SUMMARY = "taskDesc"; // NOI18N
5.20
5.21 transient protected TaskNode rootNode = null;
5.22 transient protected MyTreeTable treeTable;
5.23 @@ -111,6 +113,9 @@
5.24
5.25 transient private ActionPerformer deletePerformer;
5.26
5.27 + /** Annotation showing the current position */
5.28 + transient protected Annotation taskMarker = null;
5.29 +
5.30 /** Construct a new TaskListView. Most work is deferred to
5.31 componentOpened. NOTE: this is only for use by the window
5.32 system when deserializing windows. Client code should not call
5.33 @@ -127,7 +132,7 @@
5.34 super();
5.35
5.36 this.category = category;
5.37 - this.title = title;
5.38 + setName(title);
5.39 this.persistent = persistent;
5.40 this.tasklist = tasklist;
5.41 if (tasklist != null) {
5.42 @@ -153,6 +158,55 @@
5.43 }
5.44 }
5.45
5.46 + // override default ExplorerPanel behaviour.
5.47 + // It was set by explorer manager with setName to "Explorer[<root name>]"
5.48 + protected void updateTitle() {
5.49 + }
5.50 +
5.51 + /** Show the given task. "Showing" means getting the editor to
5.52 + * show the associated file position, and open up an area in the
5.53 + * tasklist view where the details of the task can be fully read.
5.54 + */
5.55 + public void showTask(Task item, Annotation annotation) {
5.56 + hideTask();
5.57 + if (item == null) {
5.58 + return;
5.59 + }
5.60 +
5.61 + Line l = item.getLine();
5.62 + if (l != null) {
5.63 + if (taskMarker == null) {
5.64 + if (annotation != null) {
5.65 + taskMarker = annotation;
5.66 + } else {
5.67 + taskMarker = new TaskAnnotation(item);
5.68 + }
5.69 + } else {
5.70 + taskMarker.detach();
5.71 + }
5.72 + if (l != null) {
5.73 + taskMarker.attach(l);
5.74 + // Show the line!
5.75 + l.show(Line.SHOW_GOTO);
5.76 + } else {
5.77 + taskMarker = null;
5.78 + }
5.79 + }
5.80 +
5.81 + }
5.82 +
5.83 + /** Called to indicate that a particular task should be hidden.
5.84 + This typically means that the task was deleted so it should
5.85 + no longer have any visual cues. The task referred to is the
5.86 + most recent task passed to showTask.
5.87 + */
5.88 + public void hideTask() {
5.89 + if (taskMarker != null) {
5.90 + taskMarker.detach();
5.91 + taskMarker = null;
5.92 + }
5.93 + }
5.94 +
5.95 /**
5.96 * Could be overridden to change actions for the toolbar.
5.97 * @return actions for the toolbar or null
5.98 @@ -194,7 +248,8 @@
5.99 */
5.100 protected void componentOpened() {
5.101 // Register listeners, such as the editor support bridge module
5.102 - registerListeners();
5.103 + // TODO: Listeners from Lookup will not be collected
5.104 + // registerListeners();
5.105
5.106 if (initialized) {
5.107 return;
5.108 @@ -251,7 +306,8 @@
5.109
5.110 /** Called when the window is closed. Cleans up. */
5.111 protected void componentClosed() {
5.112 - hideList();
5.113 + hideTask();
5.114 + hideList();
5.115
5.116 // Remove any task markers we've added to the editor
5.117 if (unshowItem != null) {
5.118 @@ -259,7 +315,7 @@
5.119 }
5.120
5.121 // Unregister listeners
5.122 - unregisterListeners();
5.123 + unregisterListeners();
5.124 }
5.125
5.126
5.127 @@ -701,15 +757,13 @@
5.128 objectOutput.writeObject(title);
5.129 objectOutput.write(persistent ? 1 : 0);
5.130 }
5.131 -
5.132 - public static final String PROP_TASK_SUMMARY = "taskDesc"; // NOI18N
5.133
5.134 /** Return the name of this window ("task list"), as
5.135 * shown in IDE tabs etc.
5.136 * @return Name of window */
5.137 - public String getName() {
5.138 + /*public String getName() {
5.139 return title;
5.140 - }
5.141 + }*/
5.142
5.143 /** Create the list of columns to be used in the view.
5.144 NOTE: The first column SHOULD be a tree column.
5.145 @@ -1081,17 +1135,17 @@
5.146 }
5.147
5.148 private Node.Property getNodeProperty(Node node, Node.Property prop) {
5.149 - Node.PropertySet[] propsets = node.getPropertySets();
5.150 - for (int i = 0, n = propsets.length; i < n; i++) {
5.151 - Node.Property[] props = propsets[i].getProperties();
5.152 + Node.PropertySet[] propsets = node.getPropertySets();
5.153 + for (int i = 0, n = propsets.length; i < n; i++) {
5.154 + Node.Property[] props = propsets[i].getProperties();
5.155
5.156 - for (int j = 0, m = props.length; j < m; j++) {
5.157 - if (props[j].equals(prop)) {
5.158 - return props[j];
5.159 - }
5.160 + for (int j = 0, m = props.length; j < m; j++) {
5.161 + if (props[j].equals(prop)) {
5.162 + return props[j];
5.163 }
5.164 }
5.165 - return null;
5.166 + }
5.167 + return null;
5.168 }
5.169
5.170
5.171 @@ -1415,6 +1469,8 @@
5.172 }
5.173
5.174 protected void componentHidden() {
5.175 + hideTask();
5.176 +
5.177 // Stop listening for node activation
5.178 getExplorerManager().removePropertyChangeListener(this);
5.179