Lecture Software construction - Lab 2: Programming in eclipse

In this chapter, the following content will be discussed: Benefits, code completion, faster code/compile/run cycles (real time), open source (free), extensible (plugins), disadvantages, pretty heavyweight, requires JRE, learning curve. | Software Construction Lab 2 Programming in Eclipse Introduction to Eclipse Sampling of Some Other Features Import organization Context assist Javadoc assist Getter/Setter generation Add unimplemented methods Exception handling Reminders Local history Import Organization Eclipse can automatically include import statements for any classes you are using, just press Control + Shift + o (letter o) Import Organization (continued) If the class is ambiguous (more than one in the API) then it will ask you to select the correct one Import Organization (continued) Import statements automatically included and organized You can organize imports to clean them up at any time Context Assist If you are typing and press a “.” character and pause a second, Eclipse will show you a list of all available methods for the class Prevents having to browse javadocs to see what methods are available Get context assist at any time by pressing Control + Space Javadoc Assist Eclipse can also help generate javadoc comments for you, simply place the cursor before the method and then type “/**” then Enter Javadoc Assist (continued) Eclipse will automatically generate a javadoc header for the method all stubbed out with the parameters, return type and exceptions Getter/Setter Generation Eclipse can automatically generate getters and setters for member of a class Getter/Setter Generation (continued) To generate getters and setters, right click in the main pane, then select Source Generate Getters and Setters Getter/Setter Generation (continued) Here you can selectively choose members for which to generate getters and setters Getter/Setter Generation (continued) Eclipse will then automatically generate the code for the getters and setters Add Unimplemented Methods Eclipse can also stub out methods that need to be present as a result of implementing an interface Add Unimplemented Methods (continued) You can use the quick fix light bulb to add the interfaces unimplemented methods to the class Add Unimplemented Methods (continued) Again Eclipse will go ahead and stub out the method for us Exception Handling Eclipse will also pickup on unhandled exceptions Exception Handling (continued) By clicking on the quick fix light bulb, Eclipse can suggest what to do to handle the exception Exception Handling (continued) Eclipse can automatically add a “throws declaration” to the method signature Exception Handling (continued) Alternately, Eclipse can also wrap the code inside a try/catch block Tasks Eclipse allows you to insert reminders into your code and stores them for you to come back and revisit them Eclipse recognizes the following tags inside comments TODO FIXME XXX You can even add your own custom tasks through the preferences menu Tasks (continued) To add a table of all reminders in all of your source code you can add the Tasks view by clicking on Window Show View Tasks Tasks (continued) This neatly displays all tasks in a tabular form Local History Eclipse maintains a local history of file revisions which can be accessed by right clicking on the class, then selecting Compare With Local History Local History (continued) Previous saved revisions are displayed in the History pane, double click a revision to view in the built-in diff viewer Summary Benefits Code completion Faster code/compile/run cycles (real time) Open source (free) Extensible (plugins) Disadvantages Pretty heavyweight Requires JRE Learning Curve

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
463    20    1    27-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.