![](/img/trans.png)
[英]Eclipse Organize Imports Shortcut (Ctrl+Shift+O) is not working
[英]Can Eclipse the Organize Import (ctrl+shift+o) command's handling of static imports be modified?
我一直使用Eclipse鍵盤快捷鍵Ctrl + Shift + O (Organize Imports)。
但是,它有一個特別煩人的行為:
如果我有任何靜態導入,如:
import static java.lang.Math.*;
Organize Imports將“幫助”用僅我實際使用的字段和方法的靜態導入替換它。 例如:
import static java.lang.Math.PI;
import static java.lang.Math.cos;
有沒有辦法從Organize Imports中刪除這種行為?
當然:窗口 - >首選項 - > Java - >代碼樣式 - >組織導入
將"Number of static imports needed for .*"
的值調整為1,並始終使用。*。 當然,這並不完全等於說,“見好就收靜態導入獨”,但希望這是你想要的。
基本上,這個數字表示“如果我導入這么多項目,請使用此導入的所有方法或字段”因此,如果數字為2,則僅當您使用兩個或更多導入時才會添加星號。 這將解決您在回復中說的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.