4. Eclipse Day India 2014 | Eclipse Tips and Tricks
4
Show Workspace Location in the Title Bar
OR
(-showLocation)
5. Eclipse Day India 2014 | Eclipse Tips and Tricks
5
Show Workspace Name in the Title Bar
(Window > Preferences > General > Workspace)
6. Eclipse Day India 2014 | Eclipse Tips and Tricks
6
Create Eclipse shortcuts with default workspaces
(-data workspacePath)
7. Eclipse Day India 2014 | Eclipse Tips and Tricks
7
Working Sets
Package Explorer >
Configure Working Sets…
Package Explorer >
Top Level Elements >
Working Sets
8. Eclipse Day India 2014 | Eclipse Tips and Tricks
8
Abbreviate package names with custom rules
Window > Preferences >
Java > Appearance > Abbreviate package names
9. Eclipse Day India 2014 | Eclipse Tips and Tricks
9
Export/Import
File > Export…
General > Preferences
File > Import…
General > Preferences
11. Eclipse Day India 2014 | Eclipse Tips and Tricks
11
Talk to Eclipse : Start typing and get the results from many categories of UI elements.
+
Ctrl
3
12. Eclipse Day India 2014 | Eclipse Tips and Tricks
+
Ctrl
O
12
Quick Outline:
To list the structural elements of the file (such as classes, fields, methods for a Java source file). In-place Outline:
To pop up an in-place outline of the element at the current cursor position.
+
Ctrl
F3
13. Eclipse Day India 2014 | Eclipse Tips and Tricks
13
Toggle Breadcrumb tool bar buttonShowsthepathtotheelementatthecursorposition. Navigatetootherelementsviadrop-downsandinvokeactions(whenotherviewsarenotvisible). Also available on multiple editors that are open side-by-side.
14. Eclipse Day India 2014 | Eclipse Tips and Tricks
14
Ctrl+Clickonapropertykeyinthe*.propertiesfileshowstheplacesinsourcecodewhereitisbeingusedandtakesyoutothereferencingcode.
15. Eclipse Day India 2014 | Eclipse Tips and Tricks
15
Findsundefined,unusedandduplicatekeys.
Source > Find Broken Externalized Strings
16. Eclipse Day India 2014 | Eclipse Tips and Tricks
16
Fromastacktraceinlogfile,insteadoflocatingthefileandgoingtothelinenumberviaCtrl+L,useJavaStackTraceConsole. Copythestacktracefromlogfileandclick: Copythestacktraceandpasteontheconsole: ClickonthehyperlinksforJavaclassnameswithlinenumberstonavigate. Clickingontheexceptionnameinstacktracewillcreateanexceptionbreakpoint.
Navigate > Open from Clipboard
Console view > Open Console (drop-down menu) > Java Stack Trace Console
OR
17. Eclipse Day India 2014 | Eclipse Tips and Tricks
17
Toopenthefoldercontainingaresource,inyoursystem'sfileexplorer.
Context menu: Show In > System Explorer
19. Eclipse Day India 2014 | Eclipse Tips and Tricks
19
+
+
Alt
F1
+
+
Alt
F2
20. Eclipse Day India 2014 | Eclipse Tips and Tricks
20
JustcopytheJavacodeandpasteonPackageExplorer. AnewJavaprojectwillbecreatedandthefilewillbeopenedintheJavaeditor.
21. Eclipse Day India 2014 | Eclipse Tips and Tricks
21
Todeterminewholastmodifiedalineofcodeandwhen.
22. Eclipse Day India 2014 | Eclipse Tips and Tricks
+
Ctrl
22
ToseetheJavadocinsuchcases,pressandhover. Whenthereisanerror/warningatanidentifier,thecorrespondingmessageisshownonhoverinsteadoftheJavadoc. Updatetexthoverkeymodifersat:
Window > Preferences >
Java > Editor > HoversToseethesourceonhover,
pressandhover.
Or use Javadoc view.
Or use Declaration view.
23. Eclipse Day India 2014 | Eclipse Tips and Tricks
23
ToignorecertaintypesfromtheOpenTypedialog,contentassist,quickfixproposals,importorganizationetc.
Window > Preferences > Java > Appearance > Type FiltersExample:
24. Eclipse Day India 2014 | Eclipse Tips and Tricks
24
TemplatesareshowntogetherwiththeContentAssist(Ctrl+Space) proposals. Thereareexistingtemplatesthatyoucanconfigureordefinenewtemplates.
Window > Preferences >
Java > Editor > Templates
OR
Templates view
25. Eclipse Day India 2014 | Eclipse Tips and Tricks
25
Tofindallread/writeaccessestotheselectedfieldorlocalvariableinthechosenscope.
OR
26. Eclipse Day India 2014 | Eclipse Tips and Tricks
26
Toeditlargenumberofalmostidenticallines.
27. Eclipse Day India 2014 | Eclipse Tips and Tricks
27
Tovieworeditmultiplesectionsofalargefileatonce.
splits the editor one above the other
splits the editor side by side
+
+
Ctrl
Ctrl
_
{
28. Eclipse Day India 2014 | Eclipse Tips and Tricks
28
FormatterOff/Ontagscanbeusedinanycommenttoturntheformatteroffandon. Example:TopreventformattingofSQLqueries.
29. Eclipse Day India 2014 | Eclipse Tips and Tricks
+
Ctrl
1
29
Don’ttypetoomuchyourself–LetEclipsehelpyouwithquickfixes, quickassists,refactorings,contentassistandmore. Examples:
Quick Assist:
Quick Fix:
30. Eclipse Day India 2014 | Eclipse Tips and Tricks
+
=
Delete current line
Ctrl
D
+
/
=
Move line(s)
Alt
+
=
Maximize/Minimize Editor/View
Ctrl
M
+
+
=
To upper case/ lower case
Ctrl
X
+
=
Comment/Uncomment line
Ctrl
/
/
Y
+
=
Quick Switch Editor
Ctrl
E
+
+
Alt
=
Expand selection to enclosing element
+
+
=
Lists all keyboard short cuts
Ctrl
L
30
Examples:
32. Eclipse Day India 2014 | Eclipse Tips and Tricks
32
Tostepintoasinglemethodwithinaseriesofchainedornestedmethodcalls. Example:
+
+
Ctrl
Alt
Click
+
Ctrl
F5
OR
OR
33. Eclipse Day India 2014 | Eclipse Tips and Tricks
33
LineBreakpointConditionalBreakpointExceptionBreakpoint:
Whenexceptionsarepassedoverseverallayers,theyareoftenwrappedordiscardedinanotherexception.Tofindtheoriginsofanexception,useExceptionbreakpoint.Theexecutionwillsuspendwhenevertheexceptionisthrownorcaught.
34. Eclipse Day India 2014 | Eclipse Tips and Tricks
34
ClassloadBreakpoint:
Toinspectwhoistryingtoloadtheclassorwhereisitusedforthefirsttime. Watchpoint:
Tosuspendtheexecutionwhereafieldisaccessedormodified. MethodBreakpoint:
Tosuspendtheexecutionwhenthemethodisenteredorexited.
35. Eclipse Day India 2014 | Eclipse Tips and Tricks
35
:Apointincodewherethedebuggerdoesnotbreaktheexecutionbutonlyprintstoconsole. Todebugraceconditionsortoseetheorderofthreadsexecution. Topreventtheadditionofprintstatementsinthecodewhiledebugging.
Set a conditional breakpoint withSuspend when 'true'option and a condition which is always false (eg: return false;) as the last statement.
36. Eclipse Day India 2014 | Eclipse Tips and Tricks
36
Tofilteroutspecifiedclassesandpackageswhilestepingintocodeduringdebugging.
IntheDebugview,theselectedstackframe'spackageordeclaringtypecanbequicklyaddedtothelistoffiltersbyselectingFilterTypeorFilterPackagefromthestackframe'scontextmenu.
Window > Preferences >
Java > Debug > Step Filtering
OR
37. Eclipse Day India 2014 | Eclipse Tips and Tricks
37
Acontainerforrandomsnippetsofcodethatcanbeexecutedanytimewithoutacontext. ToexperimentwithanAPIortestapieceofcode(algorithm/method). Noneedtocreateanewproject/class/mainmethod/ runtheapplicationtotest.
38. Eclipse Day India 2014 | Eclipse Tips and Tricks
38
LASTBUTNOTTHELEAST!
Help > Welcome >
What’s New
Help > Tips and Tricks...