简体   繁体   English

一次导入eclipse中的所有导入?

[英]Import all imports in eclipse at once?

Okay, I recently started learning Java/Android so I look up a lot of tutorials and do a lot of copying/pasting, but most of the times the tutorial doesn't have the imports imported, so I have to go down the line clicking all the errors then Import this, import that, import something else! 好吧,我最近开始学习Java / Android,所以我查了很多教程并进行了大量的复制/粘贴,但大多数时候教程都没有导入导入,所以我必须点击这一行所有错误然后导入此,导入,导入别的东西! So... my question: Is there a way to import all of them at once? 所以...我的问题:有没有办法一次导入所有这些?

On Windows you can use: Ctrl + shift + o which is a shortcut to Organize imports 在Windows上,您可以使用: Ctrl + shift + o这是组织导入的快捷方式

On Mac it is Command + Shift + O (Thanks orip) 在Mac上它是Command + Shift + O (感谢orip)

使用: Ctrl + shift + L查看可用的快捷方式列表

There are classes that have same name but do different work. 有些类具有相同的名称但执行不同的工作。 See how many classes Date . 看看有多少课Date At first time this looks not comfortably, but you will get used very fast. 在第一次看起来不舒服,但你会得到很快的使用。 You can organize your imports automatickly, in NetBeans I use Ctrl + shift + i hotkey. 您可以自动组织导入,在NetBeans中我使用Ctrl + shift + i热键。 There must be analog in other IDE`s. 在其他IDE中必须有模拟。

Also importing a whole package (like this: java.util.* ) is a bad practice 同样导入整个包(如: java.util.* )是一种不好的做法

You have some shortcuts on eclipse, look this page. 你在eclipse上有一些快捷方式,看看这个页面。

http://www.allapplabs.com/eclipse/eclipse_shortcuts.htm http://www.allapplabs.com/eclipse/eclipse_shortcuts.htm

I hope it help you, there you have the shortcuts named before for they and others more. 我希望它可以帮到你,你有更多的前所未有的快捷方式。

Sorry for mi English I hope it help you. 对不起,我希望对你有帮助。

alt(option) + enter(return)在mac系统中为Android Studio alt(option) + enter(return)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM