| Version 3 (modified by jdalbey, 7 years ago) (diff) |
|---|
NetBeans - Subversion Tutorial
NetBeans has Subversion features integrated into the IDE.
Prerequisites
You must have been issued a username and password for the TMC project Subversion repository.
You must have installed NetBeans ver 6.9 or later.
The project manager may want to reset the Pizza project resources.
Checkout the NetBeans project
Checkout the repository into NetBeans.
- Start NetBeans.
- From the menubar select Team > Subversion > Checkout.
In the Checkout dialog, enter
Repository URL: svn_ssh://git.tokomak.net/svn/tmcsimulator/branches/SVNtutorial
Supply Username/Password (for repository account).
- Click Next. (Observe "connecting to Subversion Repository" progress bar). If Linux prompts you to enter a "Master Password" you may click "Cancel."
- If a Server Certificate Verification Failed dialog appears, double check the Certification Information, then click "Accept".
- The Folders to Checkout dialog will appear. Enter these fields:
Repository folder: branches/SVNtutorial
Verify Local Folder: /path/to/folder/NetBeansProjects
Check the box: Scan for NetBeans Projects after Checkout.
Click Finish. - Checkout Completed dialog will appear. Click Open Project.
- PizzaOrderIntl will appear in the Projects panel. Right-click on the project name and select "Run" from the context menu.
- A window should appear with the Pizza Order International application.
- To operate the application,
- Check one or more checkboxes for your desired toppings and click the Submit button.
- Display the toppings in a different language by choosing a locale from the combo box. (Initially, only English and Spanish are enabled).
- View the authors by selecting Credits from the Help menu.
Modify the project
You will be enhancing the application to include labels in another language.
Create a new label properties file
- Decide which language you want to implement. View the locales in the combo box and select one that does NOT have an author in the Credits page. You can verify that it has not been implemented by selecting it and observing that the labels remain in English.
- In the project pane,
expand the project node (PizzaOrderIntl),
expand Source Packages,
expand resources
- Right-click on Labels.properties and select Add -> Locale.
- In the New Locale dialog, select the language code you have chosen from the Language Code combo box (NOT the Predefined Locales list). Click OK.
- Observe a new properties file appears in the list of Labels files. It will be colored green because it isn't yet part of Subversion. Double-click on your new language file and and edit window will appear containing the default properties:
# This is the default Labels.properties file label1 = Toppings choice1 = Onions choice2 = Mushrooms choice3 = Peppers choice4 = Olives choice5 = Tomatoes choice6 = Pepperoni button1 = Submit message1 = You ordered a pizza with these toppings:
- Using Google Translate or other resource, replace each english word with the corresponding phrase in the target language. (You won't be graded on correctness).
- Change 'default' in the first line to whatever locale you are creating.
- Save the file. (Ctrl-S)
- Run the application, select your language from the combo box, and you should observe the labels are changed appropriately. Click Submit and verify the message appears correctly.
- Exit the application, correct any mistakes in your properties file.
- When the properties file is complete and correct, add it to Subversion by right-clicking on the file in the project pane and choose Subversion > Show Changes
- NetBeans displays a Subversion status window. Your new file should appear with a status "Locally New". Click the "Update All" icon.
- It's unlikely, but possible, that someone else picked the same language as you and created the same file since you began this activity. If they completed the activity before you did, when you do "Update All" you'll get this error:
Failed to add file 'NetBeansProjects/PizzaOrderIntl/src/pizzaorderintl/resources/Labels_xx.properties': an unversioned file of the same name already exists
If that happens, right-click and delete the file, then choose a different language, and go back to step 1 of this section. - Right-click on the file and choose "Commit". Enter a Commit Message such as "Labels_FI.properties added for Finnish language." Click the Commit button. Note: It's usually helpful to include the name of the file being modified as the first item in the commit message.
- The Subversion status window should clear and the file text color turns from green to black.
Add yourself to the Credits page
- In the project pane, right-click on Source Packages, and from the context menu select Subversion > Update. This updates your working copy with the most recent additions in the repository.
- In the project pane,
expand the project node (PizzaOrderIntl),
expand Source Packages,
expand resources.
Double-click on Credits.txt. - The text file opens in the editor window.
- Add your Language Code and your first initial and last name to the bottom of the file. Save the file.
- Run the application, and verify that your name appears properly in the Credits box (Help -> Credits).
Update your files from the repository.
- In the project pane, right-click on the Source Packages, and from the context menu select Subversion > Update.
- If no one else made any changes to the Credits.txt while you were working on it, the Update step will be successful. Skip to the Commit step.
- If the Versioning Output shows a status of "Conflict" then someone else updated the Credits at the same time.
- Right-click on the file and select Subversion > Revert Modifications.
- Select the .txt file in the dialog which appears and click Select.
- In the Revert Modifications Dialog, "Revert Local Changes" radio button should be selected. Click Revert.
- Now repeat the steps in adding yourself to the credits page.
Commit your changes to the repository.
- In the project pane, right-click on Source Packages, and from the context menu select Subversion > Commit. Enter a Commit Message such as "Added J. Smith to credits box." Click the Commit button.
- Exit NetBeans. You're done!
- If you somehow made a mistake and destroyed someone else's work (or otherwise messed things up), inform the instructor and he will revert the repository for you.
TBD: add some tips on writing good commit messages.

