Using Eclipse for programming in DWARF
When the DWARF project started, Eclipse was in its very beginning and no one of the developers of DWARF knew about the conveniences for projects introduced for the Eclipse IDE. This convenince places every project in a separate directory. When a project is shared with other developers by use of CVS, no files will be written in the CVS top level directory.
On the other hand this fact prohibits checkouts of DWARF inside Eclipse.
Getting the source files
Just do a checkout via command line. See the
DwarfFaq for further details.
Getting the source files into Eclipse
Before starting to edit in source code files, you have to decide, if you want to use the Eclipse CVS feature to do checkins or if you want to use just the command line CVS.
Using Commandline CVS
This is the easier solution. Open the Java Browsing perspective (Window -> Open Perspective. I prefer this perspective, but you can use what ever you want to.). Do a right click in the Projects pane and click on NEW -> Project. Search for 'Java Project' and click 'NEXT >'. Find a suitable project name and 'Create project at external location': Search the directory of your service, the java_common directory or whatever you want to edit and the click 'NEXT >'.
Note: When you are using command line CVS, you should not forget to 'Refresh' after a 'cvs upd -d -P'.
Now continue at the section 'Referencing other Libraries'
Using Eclipse's CVS feature
You can use Eclipse's CVS feature, but you also have to da a command line checkout. After this, start Eclipse and switch to the 'CVS Repository Exploring' (Window -> Open Perspective). Do a right click on the left panel and on 'New -> Repositoy Location'. Fill out the form:
Within the CVS Repository search the Project (Service or src/common/java or whatever you want to edit) and check it out to the
same directoy where you did your command line checkout. E.g.: Checkout the dwarf/src/services/PatternCollisionDetection to the directory dwarf/src/services/PatternCollisionDetection.
Note: When working with Eclipse 3.0, I had problems accessing the CVS after the checkout. I found a solution in the Projects properties: Right click the Project in the
Projects view and select
Properties. On the opening pane, select
CVS and click the
Change Sharing button. Select your
:extssh:... repository and click
OK.
Referencing other Libraries
You will come to the 'Java Settings' page. Select the tab 'Libraries' and add all jars from your
/libexec.
Note1: When you are also like to edit the src/common/java project, you should not add the Util.jar but reference the src/common/java project in the 'Projects'-tab. If you do not have it, you have to check it out as a project (dwarf/src/common/java)
Note 2: When editing IDLs, you have to deploy (call make install) before you can use the generated class files from the generated jars. Because of this we added the jars as external jars.
Now click 'Finish' and you can start programming.
Useful Plugins
- Subclipse: A plugin for accessing svn repositories.(Eclipse 2.X and 3.X)
- XMLBuddy: A good XMl Editor (Syntax highlighting, DTD insight, code completion)
- Kamstruplinnet Callers: Provides a call stack for methods (Button on the right in the toolbar) (Eclispe 2.X)
- Kamstruplinnet Implementors: Searches implementations of abstract methods and interface methods (Alt- ) (Eclispe 2.X)
- Checkstyle: Checks source code for coding conveniences (Work in Progress: We will define a useful set of checking rules in the near future)
Eclipse 3.0 Preferences
Here you can retrieve the Workspace Preferences for Eclipse 3.0 . With these preferences our code formatter suits to the files in the CVS and only real modifications will be displayed in cvs diffs. How to import them depends on your current eclipse version:
- Use the Window->Preferences dialog (bottom left).
- Use the import wizard. (File->Import->Preferences)
Eclipse 3.0 - Placing jars in jre/lib/ext
When you do this, you'll have to
- Click: Window -> Preferences
- Tree: Java -> Installed JREs
- Click: Search
- Search the java's home folder, where you placed the jars
- Select the new found JRE
Most useful Keyboard Shortcuts
Ctrl-Space | Code Insight (alike Tab-Completion) |
Ctrl-F6 | Switch editor tabs |
Alt-[left/right] | back/forward to last edit position |
Ctrl-Shift-F | Format code (Please ensure that you have the Workspace Preferences for Eclipse 3.0 installed, see section above) |
Ctrl-Shift-O | Organize imports |
Ctrl-Shift-T | Open Type (class) |
Ctrl-Shift-R | Open Resource (e.g. xml, iv, wrl, txt, ...) |
Ctrl-Shift-G | Global Search: Executed on a method it lists all callers |
Ctrl-M | Maximize/Minimize current panel |
Ctrl-1 | Provides Qick-Fixes (like local rename, ...) for the element under the cursor position |
Alt S T | Used on a marked block it surrounds it with a suiting try-catch block |
-- MichaelSchlegel - 21 Mar 2006