Tasks View
Purpose: To test the Tasks view in Eclipse. We will create a java
project with java classes, introduce errors in those classes, add tasks
to the files, and then verify them in the tasks list. We also test
the persistance of task filtering between sessions.
Setup:
-
Install Eclipse Platform.
Method:
-
Start the workbench.
-
Create a Java Project named TaskProject. Then create a class named
TaskClass with the following content.
public class TaskClass {
private int y;
public TaskClass() {
}
public void doThis() {
}
abstract public void doThat();
public int getX() {
return x;
}
}
-
If you save this file 2 errors will appear in the source. On line
7 there is an error because abstract methods can only be defined in an
abstract class. On line 9 there is an error because x is unknown.
-
Open the Tasks view by invoking Perspective > Show View > Tasks.
Verify that the tasks views appears and that it does not show the 2
errors in the TaskClass.
-
Select the first line of TaskClass and invoke "Add Task" from the context
menu. Override the label with "Test Label" and press OK. Verify
that a new task icon appears on the left edge of the editor and in the
tasks view.
-
Now select the Tasks view and select the task item labelled "Test Label".
Invoke Edit > Delete to delete this task and then verify that it disappears
from the tasks view and from the open editor.
-
Within the Tasks view you can also create new tasks. To test this
press the "New Task" button on the toolbar. A new task should appear.
Type in the label for this task and press Return. Verify that a new
task is created. Do this a couple of times to create more than one
task.
-
A task is very similar to a bookmark. If you select a task you can
open an editor on the task source. To test this close all editors.
Then select one of the java problems for TaskClass.java and invoke Go To
File in the context menu. Verify that an editor opens on the task
and that the task is indicated by selection in the editor.
-
Now invoke the Filters toolbar action and change the "Where priority is:"
option to "High" and nothing else. Press OK and verify that
only high priority tasks appear in the task list now.
-
Reopen the Filters dialog and select "On Selected Resource Only".
Press OK. Now select TaskClass.java in the navigator and verify that
the tasks for this file are visible in the task view. Select
the TaskProject and verify that the tasks for TaskClass.java are
not visible in the tasks view.
-
Now the task list contains a number of tasks. It also has a couple
of filtering options. This state is persisted between
sessions. To test this note the state of the task view.
Then close the workbench and restart it. Verify that the visible
set of tasks and the filtering options are restored.