0% found this document useful (0 votes)
73 views

Using Eclipse IDE

This document provides guidance on using the Eclipse IDE to read code. It discusses Java concepts, Eclipse features like views and perspectives, and how to open, browse, and debug code in Eclipse. The objective is to enable readers to comprehend code more effectively than with basic text editors by leveraging Eclipse's code navigation and visualization capabilities.

Uploaded by

kaykay19
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Using Eclipse IDE

This document provides guidance on using the Eclipse IDE to read code. It discusses Java concepts, Eclipse features like views and perspectives, and how to open, browse, and debug code in Eclipse. The objective is to enable readers to comprehend code more effectively than with basic text editors by leveraging Eclipse's code navigation and visualization capabilities.

Uploaded by

kaykay19
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Layout for Learning to read code in Eclipse IDE

Eclipse IDE (or any other IDE) has lots of features to enable people to interact with code,
both writing and comprehending code, more effectively than simple text editors

The objective of this guide is on using Eclipse IDE to read code than writing code.

Layout for Learning to read code in Eclipse IDE................................................................1


Java constructs.................................................................................................................2
Object-oriented ...........................................................................................................2
Packages (namespaces) & classes................................................................................2
Runtime........................................................................................................................2
About Eclipse IDE...........................................................................................................3
Source code metadata..................................................................................................3
Eclipse workspace........................................................................................................3
How to create projects.................................................................................................3
How to import projects................................................................................................3
How to compile projects..............................................................................................3
How to run code in Eclipse..........................................................................................3
How to read code in Eclipse IDE?...................................................................................4
Views & editors...........................................................................................................4
Perspectives..................................................................................................................4
How to Open ...............................................................................................................4
Java Editor...................................................................................................................4
References within the code..........................................................................................4
How to debug in Eclipse IDE?.........................................................................................6
Debug Perspective and various views..........................................................................6
Debugging a Java process............................................................................................6
Setting the source lookup.............................................................................................6
Debugging approaches.................................................................................................6
Eclipse Shortcuts..............................................................................................................7
Java constructs
Recap of java constructs – some important key structures of the language and runtime –
which is a must when comprehending or debugging java code effectively.

Object-oriented
• Abstraction
i. Class hierarchies
ii. Interfaces, abstract classes
• Encapsulation
i. private/public/protected
• Polymorphism

Packages (namespaces) & classes

Runtime
o Classpath
o Library dependencies
 how it works and how to resolve issues
About Eclipse IDE
Key feature of Eclipse IDE, and basic operations in Eclipse

Source code metadata


o java indexers (build a metadata index about classes)

Eclipse workspace
o When would you want to create a different workspace
o Similar to VS ‘solution’

How to create projects

How to import projects

How to compile projects


o Build settings
o Classpath

How to run code in Eclipse


How to read code in Eclipse IDE?
Various features of Eclipse IDE that helps interact with code effectively.

Views & editors


Each view is a small window that projects a ‘view’ of the metadata of source
code.
o Package Explorer
o Navigator
o Outline
o Console
o Problems

Perspectives
Layout of different views of interest to make yourself comfortable with
operation that you are doing. One can modify the layout of views, add more
views etc…
o Java
o Debug

How to Open
o Files of interest
o Classes of interest

Java Editor
o Go to methods/fields
 In this class
 In super classes
 In sub classes
o Go to definition of methods

References within the code

o How to check parent and child classes?


 Type hierarchy

o How to check which function calls which?


 Call hierarchy
• Callers
• Callees
• For constructors too!
 Catch!
• When interfaces are called
• Reflections
o How to find references of a member field/method etc…
 When a member is updated
 When a member is read
 Notes on what is a bean, remember to watch out for callers of
Setters and Getters.
How to debug in Eclipse IDE?

Debug Perspective and various views


 Debug view
 Variables
 Breakpoints

Debugging a Java process


 Process launched from Eclipse
 Attaching to a remote process thru socket
o What is needed to attach a process
o Windows
o Linux
o IBM java (AIX)

Setting the source lookup


Setting the source lookup path is to ensure we see the source code in editor for the
method in the stack frame.

Debugging approaches
These are general debugging approaches that apply to any IDE. We are highlighting how
to go about it

 Breakpoints
o Important entry-point methods

 Inspecting variables
o Catching changes in variables

 Catching Exceptions before application does


Eclipse Shortcuts
Source code browsing -
Ctrl+Shift+R - Open Resource - open an existing file in the current open projects
Ctrl+Shift+T - Open Type - open any class that is present in source/referenced jar files -
useful when you want to know which jar the class file is present

F3 – Open Definition – of a class/method based on selection (Ctrl + Click on


class/method does the same)

Ctrl+Alt+H - Open Call hierarchy for a selected method


Ctrl+T - Open Type hierarachy - open all parent and children classes/methods for the
current selection

Search -
Ctrl+F - search in current file
Ctrl+K, Ctrl+Shift+K - continue search forward/backward in current file (like F3 in UltraEdit
VC++)
Ctrl+H - Advanced Search dialog

General –
Ctrl+M - Maximize/Restore of any view

When writing code -


Ctrl + Shift + O – to organize imports – unnecessary imports will be removed.
Ctrl + Shift +F – Format code based on configuration in Windows -> Preferences -> Java
-> Formatting
Ctrl + Space – for auto-completion

You might also like