Step 4.3: Create a Resource


Step 4.3: Create a Resource

click to expand

As I noted earlier, the Resource view is quite generic and really can't be used for anything other than gathering and arranging text documents. However, by creating a few files and moving them around, I can show you the basics of manipulating resources within the workbench.

q 4.3(a) Right-click on Simple Project and select New/File ...

click to expand
Figure 4.14: For Simple Project, select New/File ...

Since the File... option ends in an ellipsis (...), you might expect that the next thing you'll see is a wizard, and you would be correct. You'll see the New File wizard, as shown in Figure 4.15.

click to expand
Figure 4.15: The New File wizard, which prompts you for the name of the new file.

q 4.3(b) Enter 'Step List.txt' in the File name: field and click Finish.

When the wizard completes, you'll be brought back to the workbench, and you'll see that a file, Step List.txt, has been added to Simple Project, as shown in Figure 4.16.

click to expand
Figure 4.16: The workbench shows the new file, as well as an editor for it.

You'll notice that a new tab appears in the editor pane for Step List.txt. This tab is highlighted, and the tab for.project is no longer highlighted. This indicates that Step List.txt is the active file. Normally, you'll only have one active file in the editor pane at a time. I'll show you later how to change that. For now, it's just time to enter the data for the file.

q 4.3(c) Enter the source as shown.

 Step 1 - Enter a Program Step 2 - Run and Debug Step 3 - Add a User Interface Step 4 - Add a Database 
click to expand
Figure 4.17: The source entered into Step List.txt.

Once you start entering data, you'll notice that the editor tab for this file has an asterisk next to the file name. The asterisk indicates that changes have occurred in this file since the last time it was saved. The only way to make the asterisk go away is by saving the affected file.

Saving items is a fairly consistent, straightforward process. The easiest way is to right-click in the editor pane for that file, then select Save. [1]

q 4.3(d) Right-click in the editor pane and select Save.

click to expand
Figure 4.18: Save the contents of the file with the popup menu.

Congratulations! You have successfully created your own text file. You could now export that to some other directory, or go on to do something else.

click to expand
Figure 4.19: The updated workbench, with the Navigator view showing the new file.

[1] As is often the case in Eclipse, there are many ways to do the same thing. In this case, you could use the save icon on the toolbar, or the File/Save... option from the main menu. I'll show you some of these alternate techniques in other steps of the book.




Eclipse
Eclipse: Step by Step (Step-by-Step series)
ISBN: 1583470441
EAN: 2147483647
Year: 2003
Pages: 90
Authors: Joe Pluta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net