有没有办法让Eclipse自动寻找静态导入?例如,现在我终于升级到Junit 4,我希望能够编写:
assertEquals(expectedValue, actualValue);
点击Ctrl+Shift+O,让Eclipse添加:
import static org.junit.Assert.assertEquals;
也许我要求太多了.
有没有办法让Eclipse自动寻找静态导入?例如,现在我终于升级到Junit 4,我希望能够编写:
assertEquals(expectedValue, actualValue);
点击Ctrl+Shift+O,让Eclipse添加:
import static org.junit.Assert.assertEquals;
也许我要求太多了.
我使用的是Eclipse Europa,它还有最喜欢的首选项部分:
Window > Preferences > Java > Editor > Content Assist > Favorites
在我的中,我有以下条目(添加时,使用"New Type"并省略.*
):
org.hamcrest.Matchers.*
org.hamcrest.CoreMatchers.*
org.junit.*
org.junit.Assert.*
org.junit.Assume.*
org.junit.matchers.JUnitMatchers.*
除三分之一外,其余均为静电进口.通过将这些作为Collection ,如果我键入"assertT
"并点击Ctrl+Space,Eclipse会提供assertThat
作为建议,如果我 Select 它,它会将适当的静电导入添加到文件中.