开发者

How to import statically all variables at the same time in eclipse when use "Add import" in eclipse?

For example i have ConstantsClass.java with :

private static fin开发者_开发知识库al String DUMMY_STRING = "dummy string";

and MyClass.java :

import net.foo.ConstantsClass;

public void doStuff(){
  String value = ConstantsClass.DUMMY_STRING ;
  doStuff2(ConstantsClass.DUMMY_STRING);
}

When i add a static import for the first DUMMY_STRING with "Add Import"(Ctrl+Shift+M), i will have

import static net.foo.ConstantsClass.DUMMY_STRING;
import net.foo.ConstantsClass;

public void doStuff(){
  String value = DUMMY_STRING ;
  doStuff2(ConstantsClass.DUMMY_STRING);
}

If i want to do it for all variables in this class, i have to make "Add import" for each "DUMMY_STRING", is there a way to do it for all "DUMMY_STRING" in one command ?


Go to the preference. Find Java -> Code Style -> Organize Imports and change the value of ***Number of static imports needed for .**** to '1'

How to import statically all variables at the same time in eclipse when use "Add import" in eclipse?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜