I wanted to know the different eclipse shortcuts available like when we wanted to write this
System.out.println();
then we simply write syso
and hit ctrl+space
then we get System.out.println();.I do not want shortcuts like for copy ctrl+c or to cut ctrl +X
screenshot of templates
These are called "editor templates", and you can see the full list in
Window --> Preferences --> Java --> Editor --> Templates
You can also create your own there, with various placeholders, eg I have one isequalto
defined like this:
${:importStatic(org.fest.assertions.api.Assertions.assertThat)}assertThat(${actual}).isEqualTo(${expected});
This will automatically add a static import and add cursor positions that can be navigated to with TAB. This can be invoked by typing isequalto
(or just ise
) and ctrl+SPACE.
For a try/catch bock, just type try
and ctrl+SPACE.
The shortcuts your referring to are called templates.
You can view them all in the IDE or make your own:
Window > Preferences > Java > Editor > Templates
Basically to use any of these templates, type their name followed by CTRL
+ SPACE
. Once you have enough of the name typed that the name is distinct, for instance syso
you can use CTRL
+ SPACE
. So you may not need to type the whole name.
What you're looking for are not shortcuts, but Templates.
Open Window -> Preferences -> Java -> Editor -> Templates and you'll see the full list.
You can even add your own templates.
GO to Help Menu in Eclipse
And Click Key Assist
It may be for Eclipse 3 but those shortcuts have been standardised for a while.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.