I have 3 things I feel like more people should know about in Eclipse:
CTRL+SHIFT+O - Organizes imports for you.
CTRL+SHIFT+F - Formats your code for you.
Plus you can drag panels outside of the Eclipse window! Screenshot.
What are yours?
- Jev.
I have 3 things I feel like more people should know about in Eclipse:
CTRL+SHIFT+O - Organizes imports for you.
CTRL+SHIFT+F - Formats your code for you.
Plus you can drag panels outside of the Eclipse window! Screenshot.
What are yours?
Configuring Eclipse so that organizing imports and code formatting happens at each Save, so that you never need those key combos in the first place.
CTRL+SHIFT+I - Fixes the indentation of the selected text.
Awww. That was my big one.
Generally any IDE has this, but if you refactor a class, field, method, variable, etc. name, rather than simply renaming it, the IDE will update all references to that specific class/field/method/variable. In Eclipse, I’m pretty sure it’s ALT + SHIFT + R.
While you are typing CTRL + SPACE will bring up the context menu. Normally it doesn’t pop up until you use the dot operator.
Also, I’m a huge fan of Eclipse’s debugger. From what I can tell, people in general don’t use debuggers a lot, but they are definitely a saving grace.
Some more handy key combos:
+1 on CTRL+SPACE, am always horrified when I see people fully typing class and variable names!
If you want to find a class, CTRL+SHIFT+T brings up the dialog, you can use camel-case to find the class, e.g. type something like VerBF or VBF finds my VertexBufferFactory class.
CTRL+SHIFT+R does a similar thing for resources (config files, XML, properties, etc)
SHIFT+ALT+S brings up the source contextual menu, handy for auto-generating (for example) constructors, getter/setters, etc.
To rename/refactor a variable, class member or class-name, highlight it and do SHIFT+ALT+R.
Go to Preferences > Java > Code Style to fiddle with the re-format and import ordering options when saving (mentioned above). You can also edit the default comments and JavaDoc when creating a new class, method, etc.
Preferences > Java > Editor > Content Assist > Favorites and add packages that commonly have static imports, the CTRL+SPACE contextual menu does not include static imports by default. Handy for stuff like org.junit.Assert and org.mockito.Mockito for unit-tests, and the various OpenGL APIs.
I can’t use the ALT+SHIFT combos because that changes my keyboard layout
CTRL+1 moves the cursor to the nearby error and opens the Quick Fix.
You can likely reassign those functions to different keystrokes. I wouldn’t know how, but just mess around the Preferences.
Awesome! I had no idea that you could set Eclipse to auto format and organize on save! I was just thinking how great it would be to have that as an option. See, I knew I joined this Forum for a reason! 8)