The Eclipse IDE - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

The Eclipse IDE

Description:

Need to add to breakpoints in Java Perspective ... Enable Condition. Enter a Java expression that will be evaluated at runtime using fields or ... – PowerPoint PPT presentation

Number of Views:255
Avg rating:3.0/5.0
Slides: 16
Provided by: usersC1
Category:
Tags: ide | eclipse | enable | java

less

Transcript and Presenter's Notes

Title: The Eclipse IDE


1
The Eclipse IDE
  • Section 10.4 (ALBINGs)
  • http//help.eclipse.org/help32/index.jsp

2
Generating Getters and Setters
  • Generating Code
  • Getters and Setters
  • Right click in the editor
  • Select Source ? Generate Getters and Setters
  • Constructor
  • Right click in the editor
  • Select Source ? Generate Constructor

3
Other Nice Features
  • F3
  • Navigating between related classes
  • Position the cursor within the referenced type in
    the java editor
  • Ctrlo
  • Opens a lookup dialog containing a list of
    members in the current java editor
  • F2
  • gives more details on the selected item
  • Ctrl1
  • Activates Quick Fix for a warning or error at the
    current cursor position
  • Ctrlspace
  • Opens a Content Assist list using the enclosed or
    previous word as a ref for finding appropriate
    content suggestions

4
Import a Project to Eclipse
  • Remove all .class files from your project folder
  • Create a new project
  • Type project name
  • Select Create project from existing source
  • Browse and select your project folder
  • Under Default output folder
  • Browse
  • Click on the Project Name
  • Create a new Folder called bin
  • Now your project works as if it has been created
    within Eclipse but it may not be under your
    workspace

5
Eclipse Debugger
6
Start a Debugging Session
  • Place a breakpoint at any line in the code by
    double clicking on the left hand-side ruler next
    to the desired line
  • Right-click the file to debug in Package Explorer
  • Debug gt Java Application
  • Debug gt Debug in case you want to specify
    command line arguments
  • Switch to Debug Perspective
  • Window gt Open Perspective gt Debug
  • Or click on Switch Button
  • Should see the following views
  • Debug
  • Variables
  • Expressions
  • Code
  • Console
  • Window gt Show View to add a missing view

7
Creating Breakpoints
  • Can create breakpoints to source at any time
  • If you run program in debug mode prior to adding
    the breakpoints
  • Program proceeds as if it is running normally
  • Debugger has no effect
  • Unless the program is waiting for input
  • Need to add to breakpoints in Java Perspective
  • Breakpoints can be added by double-clicking in
    the left ruler beside a line where you want a
    breakpoint
  • Breakpoints can be removed by double-clicking them

8
Debug View
  • Shows one or more stack frames for the given
    thread
  • A stack frame shows the execution context
  • containing local variables and arguments
  • for the method call on that position of the call
    stack
  • Note the Current Instruction Pointer in the code
    view which highlights the statement that will be
    executed next
  • The Debug Call Stack
  • Marks the line where the selected stack frame was
    suspended

9
Stepping Through Execution
  • Look above the Debug View
  • Resume (cont in jdb)
  • Resumes execution until it either ends or
    encounters a breakpoint
  • Suspend
  • Inactive if the your program is already suspended
  • Terminate
  • Stop the Java VM
  • Other step commands which are relative to the
    selected stack frame in Debug View

10
Stepping Through Execution
  • For all following commands, the current line of
    execution in the selected frame is highlighted in
    the code editor
  • Step Into(step in jdb)
  • For method invocations
  • Creates a new stack frame
  • Invokes the method in the statement
  • Suspends execution on the first statement in the
    method
  • For other statements
  • Like assignments and conditions
  • Works like a Step Over
  • Step Over (next in jdb)
  • Executes current statement and suspends execution
    on the statement after that
  • Step Return(step up in jdb)
  • Resumes execution to the end of the current
    method
  • Suspends execution on the statement after the
    method invocation or until a breakpoint is
    encountered

11
Variable View
  • The Variable View shows fields, local variables
    and method parameters for the selected stack
    frame
  • Selecting any of those variables displays its
    value
  • At the bottom of the Variable View
  • If the variable is an object as opposed to a
    primitive
  • Can also be expanded to view member variables
  • which in turn can also be expanded if appropriate

12
Expressions View
  • Accumulates references to several expressions
    that one needs to watch while debugging
  • A watch expression displays the result of a java
    expression that is reevaluated each time a thread
    is suspended
  • Right-click in the Expressions View and choose
    Add Watch Expression to create a new entry
  • catalogue.getItems.size()

13
Breakpoints View
  • Provides a list of all breakpoints set in your
    workspace
  • Allows you to enable, disable, remove one or all,
    and set conditions on the breakpoints
  • Can Add Java Exception Breakpoint by clicking on
    J! icon in the Breakpoints View toolbar
  • When you dont know what code is causing an
    exception to be thrown
  • Debugger suspends at the point before the
    exception is encountered
  • E.g. when debugging other code and you get an
    ExceptionX, dont bother looking for it, just
    enable the ExceptionX breakpoint

14
Breakpoints View
  • Right click on any breakpoint to see options
  • Select properties
  • Hit Count
  • Enable Condition
  • Enter a Java expression that will be evaluated at
    runtime using fields or variables available at
    this breakpoints position in code
  • Condition is true
  • E.g. if (catalogue.getItems().size()6) return
    true

15
Hot Code Replacement
  • Ability to change code in the midst of a debug
    session without stopping or restarting the Java
    VM
  • Replacements work only when the signature of
    existing classes dont change
  • Add a new class
  • Change the body of a method
  • Dont add or remove fields to existing classes or
    change their types after those classes are loaded
    in the VM
  • Dont add or remove methods to existing classes
    or change their signatures after those classes
    are loaded in the VM
  • Dont add or remove inner classes
Write a Comment
User Comments (0)
About PowerShow.com