問題描述
我最近從 PDT 轉移到 Netbeans,有些事情我想不通.如何讓 IDE 在自動完成類名的文件開頭使用use"語句?喜歡:
I've moved from PDT to Netbeans recently, and there is something I can't figure out. How do I get the IDE to use 'use' statements at the beginning of a file on autocompleting class names?
Like:
use FooBarBaz;
class Something extends Baz { /* ... */ }
相反,如果我使用自動完成功能,我會得到
Instead, if I use autocompletion I get
class Something extends FooBarBaz { /* ... */ }
我已經檢查了代碼完成設置,但最有希望的選項(智能)希望我首先編寫導入,以便對短類名稱使用自動完成功能.PDT 能夠將該行寫入文件的開頭.
I've checked the code completion settings, but the most promising option (smart) wanted me to first write the imports in order to use autocompletion for short class names. PDT was capable writing that line to the beginning of the file.
推薦答案
在較新版本的 Netbeans(即 7.3+)中,您可以按 Ctrl+Shift+I
(Alt+Shift+I
不會按預期工作.
In newer versions of Netbeans (i.e. 7.3+), you can press Ctrl+Shift+I
(Alt+Shift+I
won't work as expected, though).
首先,它會在您的文件中搜索任何智能或完全限定的實例,然后詢問您找到的實例應該是什么類型.然后,它將完全限定的 use 語句添加到您的文件頂部,并將源中的現有實例更改為非限定.
First, it searches for any smart or fully qualified instances in your file and then asks you of what types the found ones should be. It then adds fully qualified use statements to the top of your file and changes existing instances in the source to unqualified.
這篇關于如何讓 Netbeans 在自動完成時使用 import 語句而不是完全限定的類名?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!