I am a C# developer who is doing some Android development in Eclipse. One of my favorite keyboard shortcuts in Visual Studio is CTRL + . which brings up the SmartTag menu. This is incredibly useful for adding using statements on the fly.
As an example if I don't have an import statement for System.Xml.Linq
but create a variable of type XDocument
I can quickly add the appropriate using with the keyboard command.
Is there a similar keyboard command available in Eclipse?
Press: CTRL + SHIFT + O and you should see below dialog boxes. Choose your desired import package and click next. It will prompt you for your next import and thats it.
Ctrl + Shift + M : Add import for currently selected.
Ctrl + D. Deletes current line in the editor. Command + Shift + O.
I'm pretty sure he has Ctrl + Shift + O in mind, but I may be wrong.
You can use Ctrl + Shift + O to "O"rganize Imports (like Crembo mentions). Another neat trick is to go to Windows > Preferences, search for "Save Actions", and check "Organize Imports". Now whenever you save (Ctrl + S), Eclipse will automatically run the "organize imports" feature. I find this quicker, since it's quicker for me to hit Ctrl + S than Ctrl + Shift + O (one-hand shortcut versus two-hand shortcut).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With