Eclipse workshop
Jan. 2014
• Miguel Pardal
– LEIC 2000
– Lecturer at Técnico Lisboa
– PhD Student
– http://web.tecnico.ulisboa.pt/miguel.pardal

– Ec...
Goal
•
•
•
•

Learn the good
Avoid the bad
Become a better developer
Enjoy life!
Outline
• Introduction
– Concepts
– Techniques

• Hands-on
History
• Eclipse started out as proprietary technology
– Object Technology International (OTI)
– IBM’s goals:
• Reduce in...
History
• The Eclipse open source project was announced in November
2001 by a group of companies that formed the initial E...
Install
• Download
• Unzip
• Run
• All configurations are file-based
– workspace folder
• Settings
• Projects

– Project m...
CONCEPTS
Workbench
• Eclipse’s main window
– Menus and toolbars
– Views, editors, perspectives
View
• A view is a window that lets you examine
something
– Navigate a list or hierarchy of information
– Display properti...
Editor
• Editors are used to edit or browse a
resource
– Rectangular area in the Workbench window
– Visual presentation mi...
Perspective
• A perspective is a set of views, editors, and
toolbars, along with their arrangement within the
Workbench wi...
Java Project
Project properties
Project properties
Auto-complete
• From the current context – project, class,
method, etc – what could complete this?
– CTRL+space
Auto-build
• Compilation is automatic in Eclipse
• Blessing
– Sting s = “Eclipse”;

• Curse
– String s = “Ecli
TECHNIQUES
Factoring
• Create the application domain
• Create class
– Members
– Methods

• Generate methods
– Getters Setters
– toStr...
Create
Create class
Source menu
Testing
• JUnit Class
• JUnit View
Refactoring
• Refactoring is a process of software source code
transformation
– Should be performed when the code is worki...
Refactor menu
Quick fix errors
Quick fix warnings
Implicit class
– Write code as if the class already exists
• Write code referring to non-existing classes

– Use quick-fix...
But beware…
• Quick-fix can become “quick-bug”
• Example
– Try-catch and ignore
• Worst solution

– Try-catch, print and c...
Conclusions
• Very useful tool
• Can increase productivity
– Code formatting
– Especially in refactoring

• But…
– Does NO...
Looking ahead…

• Questions?
– Concepts
– Techniques

Miguel.Pardal@tecnico.ulisboa.pt

Thank you

Obrigado
Shortcuts

Top 10
10. Shortcut to shortcuts
• Ctrl+Shift+L to see a full list of the
currently available key bindings
9. Open file / type
• Open file quickly without browsing:
Ctrl + Shift + R
• Open a type (class / interface):
Ctrl + Shift...
8. Show properties
• Select project
Alt+Enter
• Select type/resource
Alt+Enter
7. Maximize editor
• Maximizes current editor
Ctrl + M
• You can also double-click editor tab
6. Editor navigation
•

Jump to beginning / end of indention. Twice to jump to beginning of line
– Home/End

•

Jump to be...
5. Outline view
• Quickly go to class member
Ctrl + O
4. Code formatting
• Ctrl + Shift + F for code formatting
• Ctrl + / for commenting, un commenting
lines and blocks
3. Organize imports
• Organize imports
Ctrl+Shift+O
• Go from:
– import java.util.*

• To:
– import java.util.Map;
– impor...
2. Print line
• syso Ctrl+space
• syse Ctrl+space
1. Guess Exception
• throw new NPE Ctrl+space
– NullPointerException

• throw new IAE Ctrl+space
– IllegalArgumentExceptio...
Eclipse workshop presentation
Eclipse workshop presentation
Eclipse workshop presentation
Upcoming SlideShare
Loading in...5
×

Eclipse workshop presentation

993

Published on

Eclipse workshop presentation made at Técnico Lisboa on January 2014, at the invitation of NEIIST - the Computer Science and Engineering students association

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
993
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Eclipse workshop presentation

  1. 1. Eclipse workshop Jan. 2014
  2. 2. • Miguel Pardal – LEIC 2000 – Lecturer at Técnico Lisboa – PhD Student – http://web.tecnico.ulisboa.pt/miguel.pardal – Eclipse user since 2005 – Conditional fan 
  3. 3. Goal • • • • Learn the good Avoid the bad Become a better developer Enjoy life!
  4. 4. Outline • Introduction – Concepts – Techniques • Hands-on
  5. 5. History • Eclipse started out as proprietary technology – Object Technology International (OTI) – IBM’s goals: • Reduce incompatible environments • Increase reuse of common components • Evolved from IBM VisualAge for Smalltalk™ and for Java™ – Monolithic http://wiki.eclipse.org/FAQ_Where_did_Eclipse_come_from%3F
  6. 6. History • The Eclipse open source project was announced in November 2001 by a group of companies that formed the initial Eclipse Consortium – Eclipse Foundation since 2004 • Commercial-friendly open source license – Wider audience and ecosystem • Eclipse was designed from the ground up as an integration platform for development tools – – – – Everything in Eclipse is a plug-in Uses SWT to bind to local platform GUI OSGi component model since 3.0 Annual Simultaneous Release (…, Indigo, Juno, Kepler, …)
  7. 7. Install • Download • Unzip • Run • All configurations are file-based – workspace folder • Settings • Projects – Project metadata files • .project • .classpath
  8. 8. CONCEPTS
  9. 9. Workbench • Eclipse’s main window – Menus and toolbars – Views, editors, perspectives
  10. 10. View • A view is a window that lets you examine something – Navigate a list or hierarchy of information – Display properties for the active editor • Modifications made in a view are saved immediately.
  11. 11. Editor • Editors are used to edit or browse a resource – Rectangular area in the Workbench window – Visual presentation might be text or a diagram. – Editors are launched by clicking on a resource in a view – Modifications made in an editor follow an open-save-close lifecycle model • * indicates unsaved data
  12. 12. Perspective • A perspective is a set of views, editors, and toolbars, along with their arrangement within the Workbench window. • As you perform a task, you may rearrange windows, new views, and so on. – Saved under the current perspective. – Next time, switch to perspective – Within a window, each perspective may have a different set of views but all perspectives share the same set of editors. • Built-in Java or Debug perspectives
  13. 13. Java Project
  14. 14. Project properties
  15. 15. Project properties
  16. 16. Auto-complete • From the current context – project, class, method, etc – what could complete this? – CTRL+space
  17. 17. Auto-build • Compilation is automatic in Eclipse • Blessing – Sting s = “Eclipse”; • Curse – String s = “Ecli
  18. 18. TECHNIQUES
  19. 19. Factoring • Create the application domain • Create class – Members – Methods • Generate methods – Getters Setters – toString
  20. 20. Create
  21. 21. Create class
  22. 22. Source menu
  23. 23. Testing • JUnit Class • JUnit View
  24. 24. Refactoring • Refactoring is a process of software source code transformation – Should be performed when the code is working and all of its tests are passing – Does not involve rewriting or replacing large chunks of code. – Gradual, evolutionary process, intended to “preserve the knowledge embedded in the existing code.” • Examples – Rename – Extract method
  25. 25. Refactor menu
  26. 26. Quick fix errors
  27. 27. Quick fix warnings
  28. 28. Implicit class – Write code as if the class already exists • Write code referring to non-existing classes – Use quick-fix to generate class
  29. 29. But beware… • Quick-fix can become “quick-bug” • Example – Try-catch and ignore • Worst solution – Try-catch, print and continue • As if nothing has happened… but it did! – Think it through: • Handle exception (try-catch) • Or let someone else do it (throws)
  30. 30. Conclusions • Very useful tool • Can increase productivity – Code formatting – Especially in refactoring • But… – Does NOT replace critical thought and design – Can increase the production… of bugs!
  31. 31. Looking ahead… • Questions? – Concepts – Techniques Miguel.Pardal@tecnico.ulisboa.pt Thank you Obrigado
  32. 32. Shortcuts Top 10
  33. 33. 10. Shortcut to shortcuts • Ctrl+Shift+L to see a full list of the currently available key bindings
  34. 34. 9. Open file / type • Open file quickly without browsing: Ctrl + Shift + R • Open a type (class / interface): Ctrl + Shift + T
  35. 35. 8. Show properties • Select project Alt+Enter • Select type/resource Alt+Enter
  36. 36. 7. Maximize editor • Maximizes current editor Ctrl + M • You can also double-click editor tab
  37. 37. 6. Editor navigation • Jump to beginning / end of indention. Twice to jump to beginning of line – Home/End • Jump to beginning / jump to end of source – Ctrl+Home/End • Jump one word to the left / one word to the right – Ctrl+Arrow Right/Arrow Left • Jump to previous / jump to next method – Ctrl+Shift+Arrow Down/Arrow Up • Jump to next / jump to previous compiler syntax warning or error – Ctrl+./Ctrl+, • Jump to last location edited – Ctrl+q • Jump to Line Number – Ctrl+l • Hide/show line numbers – Ctrl+F10 and select 'Show Line Numbers'
  38. 38. 5. Outline view • Quickly go to class member Ctrl + O
  39. 39. 4. Code formatting • Ctrl + Shift + F for code formatting • Ctrl + / for commenting, un commenting lines and blocks
  40. 40. 3. Organize imports • Organize imports Ctrl+Shift+O • Go from: – import java.util.* • To: – import java.util.Map; – import java.util.Iterator;
  41. 41. 2. Print line • syso Ctrl+space • syse Ctrl+space
  42. 42. 1. Guess Exception • throw new NPE Ctrl+space – NullPointerException • throw new IAE Ctrl+space – IllegalArgumentException
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×