Window Actions
Purpose: To test the standard menu and toolbar actions in Eclipse.
We will create a project, open some editors, test the global actions, test
the persistance of workbench state between sessions.
Setup:
-
Install Eclipse Platform.
-
Delete the metadata for org.eclipse.ui.
Testing the File Menu:
-
Start the workbench.
-
Invoke File > New > Project. A wizard will appear where you can select
a project type. Select each item in the left hand viewer to verify
the basic page operation. Then select Simple > Project and press
Next. Type "SimpleProject" as the name for the project and press
Finish. Verify that a new Resource perspective is created and that
SimpleProject appears in the Navigator view.
-
Create a few folders and files (one.txt, two.txt, three.txt) within SimpleProject.
For more information on this process refer to Simon's work on the New Wizard.
-
Open one.txt within a text editor. Verify that File > Close and Save
As are enabled. Verify that Save is disabled.
-
Add the following text to the file..
File One
-
Once you modify a file the File > Save action should become enabled and
a small asterix should appear in the editor tab. Invoke Save and
verify that the asterix disappears and that the File > Save action is disabled.
-
Open two.txt. Add the following text to the file..
File Two
-
Open three.txt and add the following text to the file..
File Three
-
If you close an editor which is dirty the workbench should ask if you want
to save it. With three.txt active invoke File > Close. Verify
that the Save dialog appears. Press Yes. Then reopen the file
to verify that the text was saved.
-
Invoke File > Close All. At this point there is 1 dirty editor.
Verify that the Save Resources dialog appears. Press Yes. The
dirty editors should be saved and all editors will close.
-
Verify that File > Close, Close All, Save, Save As, and Save All are disabled.
Testing the Edit Menu:
-
The edit actions should target the active view or editor. To test
this ..
-
Select a file in the navigator view. Invoke Edit > Delete and verify
that the Delete File dialog appears for the current selection in the navigator.
Close the dialog without completing the delete.
-
Select the file again and invoke Edit > Add Bookmark. Open the Bookmarks
view and verify that a bookmark exists for the file. Select the bookmark.
Invoke Edit > Delete and verify that the bookmark is deleted in the bookmarks
view.
-
Open one.txt in a text editor. Select a piece of text and invoke
Edit > Cut. Verify that the selection in the text editor is cut.
-
Create a file named X.java. Open it in an editor and then verify
that the Java editor actions are contributed to the workbench menu and
toolbar.
-
Open one.txt in an editor. Verify that the java editor actions are
no longer visible in the workbench.
-
Activate the java editor and verify that its contributions appear once
again.
-
Close the java editor and verify that the contributions disappear.