Development with Eclipse Software Engineering Prof. Werner Krandick Slides: Mat Schaffer
The Basics (or: nothing new) Eclipse as first glance looks like most other development environments (Visual Studio, JBuilder, etc.) Point out central editor window (currently displaying welcome page), project listing on left, tasks (errors) on bottom, outline view on right.
The Basics (or: nothing new) Basic features Project-based file system Class-oriented browser Actual files become secondary, as Eclipse views the project at the Class (object) level and does file management for you. Organized error viewing and running
Why Eclipse? Powerful Versatile Extensible Free! and Open-source works with Java, C, C++, PHP Extensible The whole platform is plug-in based, so new plug-ins are available for many tasks. Free! and Open-source Free download at www.eclipse.org Q: What plug-ins are available for Eclipse? A: Many many many. Eclipse has been compared to Emacs in terms of plug-ins. There are plug-ins for various programming languages (C, C++, PHP w/ MySql). There are plug-ins for chat clients (AIM, Jabber), web sites (Google, Slashdot), email clients, modeling plug-ins (UML, Rose models). - Try typing eclipse plug-in into Google and see what happens. Also you can find the Eclipse approved plug-ins on www.eclipse.org under the Plug-in project.
The Eclipse Environment The Eclipse visual environment’s organization is based on Perspectives (under the Window menu). Each perspective is a collection of Views, or internal windows (also under the Window menu). Organized for a particular task. Views can be moved, stacked (tabbed), removed or added. All by drag-drop or the options in the Window menu.
The Eclipse Environment Built in perspectives Java development Debugging CVS File navigation You also modify or create perspectives (again, Window menu)
The Java Perspective Point out: Tabbed views at bottom (Task, Console) File viewer on left Class outline on right
The Debugging Perspective Point out: Same editor window as in previous perspective Tabbed window at upper right displaying variable information Outline still on right Console at bottom Run history on top left
The CVS Perspective Point out: Repository browser on left with version numbers Revision history with comments at bottom
Cool Features Automatic Error Detection Code generation Errors are detected as you type, and every time you save Code generation Constructors Inherited abstract methods Getters/Setters Import statements Javadoc facilities Note: the features covered here focus on java, not all these features will necessarily be available for C, C++ or other languages.
Automatic Error Detection Errors are shown much like spelling errors in word. Double click any listed tasks to jump to that file/line. You can also force the building of a project (in the event an error is not caught on the fly), by selecting “Rebuild Project” from the Project menu.
Code Generation Creating a class Browse for superclass Browse for interfaces Add constructors from superclass
Code Generation Getters/Setters Create data member Use “Generate getter and setter” under Source menu Functions and javadoc are auto-generated! Note in selection window, you can chose which getters/setters get created and for which data members.
Code Generation Import Organization Write as if you had already done imports Use “Organize Imports” (source menu) [Ctrl+Shft+O] Imports are added for you!
Javadoc Facilities Need javadoc comments for a function? Use “Add Javadoc Comment” under the source menu! Javadoc comment template will be created for you to fill out with the appropriate information Javadoc for functions from an abstract class or interface will automatically refer to the parent function. See http://java.sun.com/j2se/javadoc/ for more information about javadoc and its uses.
Debugging Facilities Eclipse offers various features to make debugging easier Double click on error output to jump to that file/line Keep track of breakpoints Keep track of variables (including variables hidden in objects) All these features are made easily available in the Debug perspective.
CVS integration Eclipse can associate a project with a CVS repository location. Synchronization with CVS repository is then done by right clicking the project (or folder in the project) and selecting “Synchronize” from the “Team” menu.
CVS integration Synchronization is also done visually!
Continuing with Eclipse Visit www.eclipse.org to download a copy for your home computer Get Release version 2.1.1 (or latest) Run ‘eclipse’ on any of the machines in the CS Lab This is currently an older version, but much of the functionality is the same