Eclipse Tips & Tricks

  • View
    253

  • Download
    0

Embed Size (px)

DESCRIPTION

Eclipse Tips & Tricks

Text of Eclipse Tips & Tricks

  • 1. Eclipse Day India 2014 | Eclipse Tips and Tricks1Noopur GuptaEclipse JDT/UI CommitterIBM Software Labs, Bangalorenoopur_gupta@in.ibm.com

2. Eclipse Day India 2014 | Eclipse Tips and Tricks2 3. Eclipse Day India 2014 | Eclipse Tips and Tricks3 4. Eclipse Day India 2014 | Eclipse Tips and Tricks4Show Workspace Location in the Title BarOR(-showLocation) 5. Eclipse Day India 2014 | Eclipse Tips and Tricks5Show Workspace Name in the Title Bar(Window > Preferences > General > Workspace) 6. Eclipse Day India 2014 | Eclipse Tips and Tricks6Create Eclipse shortcuts with default workspaces(-data workspacePath) 7. Eclipse Day India 2014 | Eclipse Tips and Tricks7Working SetsPackage Explorer >Configure Working SetsPackage Explorer >Top Level Elements >Working Sets 8. Eclipse Day India 2014 | Eclipse Tips and Tricks8Abbreviate package names with custom rulesWindow > Preferences >Java > Appearance > Abbreviate package names 9. Eclipse Day India 2014 | Eclipse Tips and Tricks9Export/ImportFile > ExportGeneral > PreferencesFile > ImportGeneral > Preferences 10. Eclipse Day India 2014 | Eclipse Tips and Tricks10 11. Eclipse Day India 2014 | Eclipse Tips and Tricks11Talk to Eclipse : Start typing and get the results from many categories of UI elements.+Ctrl3 12. Eclipse Day India 2014 | Eclipse Tips and Tricks+CtrlO12Quick 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.+CtrlF3 13. Eclipse Day India 2014 | Eclipse Tips and Tricks13Toggle 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 Tricks14Ctrl+Clickonapropertykeyinthe*.propertiesfileshowstheplacesinsourcecodewhereitisbeingusedandtakesyoutothereferencingcode. 15. Eclipse Day India 2014 | Eclipse Tips and Tricks15Findsundefined,unusedandduplicatekeys.Source > Find Broken Externalized Strings 16. Eclipse Day India 2014 | Eclipse Tips and Tricks16Fromastacktraceinlogfile,insteadoflocatingthefileandgoingtothelinenumberviaCtrl+L,useJavaStackTraceConsole. Copythestacktracefromlogfileandclick: Copythestacktraceandpasteontheconsole: ClickonthehyperlinksforJavaclassnameswithlinenumberstonavigate. Clickingontheexceptionnameinstacktracewillcreateanexceptionbreakpoint.Navigate > Open from ClipboardConsole view > Open Console (drop-down menu) > Java Stack Trace ConsoleOR 17. Eclipse Day India 2014 | Eclipse Tips and Tricks17Toopenthefoldercontainingaresource,inyoursystem'sfileexplorer.Context menu: Show In > System Explorer 18. Eclipse Day India 2014 | Eclipse Tips and Tricks18 19. Eclipse Day India 2014 | Eclipse Tips and Tricks19++AltF1++AltF2 20. Eclipse Day India 2014 | Eclipse Tips and Tricks20JustcopytheJavacodeandpasteonPackageExplorer. AnewJavaprojectwillbecreatedandthefilewillbeopenedintheJavaeditor. 21. Eclipse Day India 2014 | Eclipse Tips and Tricks21Todeterminewholastmodifiedalineofcodeandwhen. 22. Eclipse Day India 2014 | Eclipse Tips and Tricks+Ctrl22ToseetheJavadocinsuchcases,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 Tricks23ToignorecertaintypesfromtheOpenTypedialog,contentassist,quickfixproposals,importorganizationetc.Window > Preferences > Java > Appearance > Type FiltersExample: 24. Eclipse Day India 2014 | Eclipse Tips and Tricks24TemplatesareshowntogetherwiththeContentAssist(Ctrl+Space) proposals. Thereareexistingtemplatesthatyoucanconfigureordefinenewtemplates.Window > Preferences >Java > Editor > TemplatesORTemplates view 25. Eclipse Day India 2014 | Eclipse Tips and Tricks25Tofindallread/writeaccessestotheselectedfieldorlocalvariableinthechosenscope.OR 26. Eclipse Day India 2014 | Eclipse Tips and Tricks26Toeditlargenumberofalmostidenticallines. 27. Eclipse Day India 2014 | Eclipse Tips and Tricks27Tovieworeditmultiplesectionsofalargefileatonce.splits the editor one above the othersplits the editor side by side++CtrlCtrl_{ 28. Eclipse Day India 2014 | Eclipse Tips and Tricks28FormatterOff/Ontagscanbeusedinanycommenttoturntheformatteroffandon. Example:TopreventformattingofSQLqueries. 29. Eclipse Day India 2014 | Eclipse Tips and Tricks+Ctrl129DonttypetoomuchyourselfLetEclipsehelpyouwithquickfixes, quickassists,refactorings,contentassistandmore. Examples:Quick Assist:Quick Fix: 30. Eclipse Day India 2014 | Eclipse Tips and Tricks+=Delete current lineCtrlD+/=Move line(s)Alt+=Maximize/Minimize Editor/ViewCtrlM++=To upper case/ lower caseCtrlX+=Comment/Uncomment lineCtrl//Y+=Quick Switch EditorCtrlE++Alt=Expand selection to enclosing element++=Lists all keyboard short cutsCtrlL30Examples: 31. Eclipse Day India 2014 | Eclipse Tips and Tricks31 32. Eclipse Day India 2014 | Eclipse Tips and Tricks32Tostepintoasinglemethodwithinaseriesofchainedornestedmethodcalls. Example:++CtrlAltClick+CtrlF5OROR 33. Eclipse Day India 2014 | Eclipse Tips and Tricks33LineBreakpointConditionalBreakpointExceptionBreakpoint:Whenexceptionsarepassedoverseverallayers,theyareoftenwrappedordiscardedinanotherexception.Tofindtheoriginsofanexception,useExceptionbreakpoint.Theexecutionwillsuspendwhenevertheexceptionisthrownorcaught. 34. Eclipse Day India 2014 | Eclipse Tips and Tricks34ClassloadBreakpoint:Toinspectwhoistryingtoloadtheclassorwhereisitusedforthefirsttime. Watchpoint:Tosuspendtheexecutionwhereafieldisaccessedormodified. MethodBreakpoint:Tosuspendtheexecutionwhenthemethodisenteredorexited. 35. Eclipse Day India 2014 | Eclipse Tips and Tricks35: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 Tricks36Tofilteroutspecifiedclassesandpackageswhilestepingintocodeduringdebugging.IntheDebugview,theselectedstackframe'spackageordeclaringtypecanbequicklyaddedtothelistoffiltersbyselectingFilterTypeorFilterPackagefromthestackframe'scontextmenu.Window > Preferences >Java > Debug > Step FilteringOR 37. Eclipse Day India 2014 | Eclipse Tips and Tricks37Acontainerforrandomsnippetsofcodethatcanbeexecutedanytimewithoutacontext. ToexperimentwithanAPIortestapieceofcode(algorithm/method). Noneedtocreateanewproject/class/mainmethod/ runtheapplicationtotest. 38. Eclipse Day India 2014 | Eclipse Tips and Tricks38LASTBUTNOTTHELEAST!Help > Welcome >Whats NewHelp > Tips and Tricks... 39. Eclipse Day India 2014 | Eclipse Tips and Tricks