Search/Navigation:
Related:
SLAC/EPP/HPS Public
Jefferson Lab/Hall B/HPS Run Wiki
S30XL-LESA/LDMX
Table of Contents | ||
---|---|---|
|
An Integrated Development Environment (IDE) should be used to develop source code. Eclipse is a good choice, as it is free, widely used, and well supported.
...
Info | ||
---|---|---|
| ||
Should Eclipse be unable to resolve a project's dependencies, try right-clicking on the project icon and selecting Maven > Update Project from the menu or hitting Alt + F5 while the project is selected. This should force Eclipse to update its index of jar files against your local Maven repository, and hopefully this will make all the red errors in your editor go away. |
Info | ||
---|---|---|
| ||
You can apply the formatting on Java files a few different ways. From the Package Explorer, you can select one or more files, and then right click and select Source > Format. Within an editor window, you can format an entire file by right clicking and selecting Source > Format. This will also work on a section of selected code. |
The HPS collaboration uses a standard Java code formatting convention based on the Java Code Conventions.
...
There are only a few changes which will be made to the defaults.
Under Tab policy, select Spaces only.
For Tab size, put 4 instead of 8.
Now your window should look something like this.
Next click Apply and then OK.
Info | ||
---|---|---|
| ||
You can apply the formatting on Java files a few different ways. From the Package Explorer, you can select one or more files, and then right click and select Source > Format. Within an editor window, you can format an entire file by right clicking and selecting Source > Format. This will also work on a section of selected code. |
Warning | ||
---|---|---|
| ||
As a general rule, tabs should never be used in any files within the SVN. Mixing tabs and spaces creates a formatting mess. And tabs may appear differently depending on how someone has their editor configured (e.g. tab indentation could be 4 or 8 spaces). For these reasons, we stick to a rule of spaces only in all our source code. |
An extensive set of Subversion commands are available under the Team and Compare with sub-menus when you right click on a Java file or package in the project.
To update a file to its current version in the trunk, you can select Team > Update.
You may compare a file against its current remote copy by going to Compare With > Latest from repository.
You can add a file to SVN by selecting Team > Add to version control.
To commit a file or select of files, you can use Team > Commit.
Under Tab policy in the formatting settings for the currently using code conventions, Spaces only should be selected with a Tab size of 4. Next click Apply and then OK.
Disable tabs in XML files by opening the Preferences menu and navigating to XML > XML Files > Editor where Indent using spaces should be selected and the indentation size set to 4. Click Apply and Okay.
To disable tabs in the general text editor, open Preferences and go to General > Editors > Text Editors and make sure Insert spaces for tabs is checked with Displayed tab width set to 4.
There are other places where this can be configured as well, for various types of editors. This link provides useful answers on where all these settings are located and how they can be configured to use spaces only.
Warning | ||
---|---|---|
| ||
Using Eclipse to commit files can be convenient. But you need to very careful about this. When you select commit, Eclipse will show a window with the list of files to be committed. Make absolutely sure that this list only contains the files which you actually want included into the commit. By default, when executing a commit from a project without any files selected, Eclipse will add every file which is not in the global ignore list to the commit. You absolutely do not want this. So if there is a huge list of files there, then click cancel and execute the command only with the correct files selected. Or you may uncheck the boxes next to files which should not be committed. Committing files from a multiple selection in the Project Explorer or Package Explorer will also work to commit only the files you want included. |
An extensive set of Subversion commands are available under the Team and Compare with sub-menus when you right click on a Java file or package in the project.
To update a file to its current version in the trunk, you can select Team > Update.
You may compare a file against its current remote copy by going to Compare With > Latest from repository.
You can add a file to SVN by selecting Team > Add to version control.
To commit a file or select of files, you can use Team > Commit.
When you remove a file using Delete from the right-click menu, Eclipse will remove the file and automatically mark it for deletion in the next SVN commit.
You should also setup some of the other editors in Eclipse to use spaces instead of tabs.
This is done through the menu under Window > Preferences.
For text editors, go to General > Editors > Text Editors > Insert spaces for tabs and check it.
For XML files, go to XML > XML Files > Editor and select Indent using spaces and set Indentation size to 4.
There are other places where this can be configured as well, for various types of editors. This link provides useful answers on where all these settings are located and how they can be configured to use spaces only.