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 shows 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.
-
If a problem is resolved or a task removed it should disappear from the
task view. Open the Task view filter dialog and reset all options
with the Reset button. Press OK and go back to the editor for TaskClass.java.
Delete the "doThat" method and save the file. Verify that one of
the errors on TaskClass.java is deleted.
-
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 problem
and that the problem is indicated by selection in the editor.
-
Now invoke the Filters toolbar action and change the "show entries of type"
option to "Java Problem" and nothing else. Press OK and verify that
only Java problems 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 java problems for this file are visible in the navigator. Select
the TaskProject and verify that the java problems for TaskClass.java are
not visible.
-
Now the task list contains a number of errors and tasks. It also
has a couple of filtering options (java problems only and selected resource
only). 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.