This chapter Eclipse Tips and Tricks demonstrate the shortcuts and tips in detail. Eclipse got designed with a lot of powerful features which are not that much easy to discover and are not leveraged to the fullest. Following are the concepts covered.
Tips and Tricks
Tips and Tricks
Description
Eclipse have some handful of useful tips and tricks, the CamelCase searching was an important feature it works quite well Content Assist. User can also use a Preference settings which force both Semicolons and Braces at the right place. In the editors like Emacs, the key sequences for keyboard shortcuts are underused and the fact is that user can pause part way through a key sequence and get a list of available choices which makes the shortcuts very affordable.
Following are some of the most useful tips which will boost the productivity while working with eclipse.
Content Assist and using CamleCase
References of using method or class in code
Use the function to search a file
Bookmarks
Saving Actions
Call Hierarchy
Hyperlink Navigation
Content Assist and using CamleCase
Description
In order to view Content Assist hit Ctrl + Space, a list get displayed providing some suggested completions as shown in the image below.
The CamleCase work for both method and classes, type some characters for a known method by which user can see all the matches related to that method, select the required method and hit enter on the selected one as shown in the image below.
Make sure that while using the Camlecase, use the correct capitalization words.
References of using method or class in code
Description
In order to find out all the methods and class which were used throughout the project can be done in an easy and quick way by following the procedure mentioned.
Select any method or class and Right click -> select Reference -> select Workspace, as shown in the image below.
Now, the Search view appears in the views window at the bottom as shown in the image below.
Use the function to search a file
Description
User can make use of search option in order to search any file, developer need not to remember everything as long as remember to put something in the search space. In order to search a file follow the procedure mentioned.
Click Search Menu -> Select File as shown in the image below.
Now, a popup window appear known as Search, select the preferred file and proceed by clicking Replace or Search button as shown in the image below.
Bookmarks
Description
Bookmarks are very useful for a developer in order to modify a code, instead of going back to the location several times user can make use of bookmark to identify that location quickly. Follow the procedure mentioned below in order to add a bookmark for selected location.
Right click on the Marker bar -> select Add Bookmark as shown in the image below.
Now, a popup window appears know as Add Bookmark, the selected line by default act as bookmark name either use the default name or change the name and proceed by clicking OK button as indicated in the image below.
Saving Actions
Description
User can automatically save some of the actions such as formatting source code, organizing imports and adding some additional actions to that imports by using the Save Action preference, in order to check the preference settings for the Save Action follow the procedure mentioned.
Click Window menu -> select Preferences as shown in the image below.
Now, select Java -> select Editor -> select Save Actions as shown in the image below.
Call Hierarchy
Description
User can get the complete Hierarchy for a selected function using the shortcut Keys, in order to call a hierarchy hit Ctrl + Alt + H combination, now user can view the complete hierarchy structure of that function in the views window at the bottom as shown in the image below.
Hyperlink Navigation
Description
Providing Hyperlink to an identifier will navigate to that respective Prototype, in order to deal with Hyperlink Navigation follow the procedure mentioned.
Hold Ctrl key -> Hover over on identifier
Now a Hyperlink get created by clicking on it will redirects to the Prototype as shown in the image below.
Summary
Key Points
The CamleCase searching is an important feature while using Content Assist.
Eclipse have a handful of tips and tricks used with shortcut keys.
Should be familiar with the shortcut keys in order to know the tricks while programming.