我已经将一个项目从 Eclipse 导入 IntelliJ,我想配置代码样式设置。但是我在声明数组时遇到了问题。
eclipse 格式化程序将代码格式化如下:
@Before
public void prepareData() throws Exception //NOPMD
{
LOG.info("Preparing setup data");
new CoreBasicDataCreator().createEssentialData(null, null);
CatalogManager.getInstance().createEssentialData(Collections.EMPTY_MAP, null);
serviceLayerDataSetup.createJobPerformables();
impExSystemSetup.createAutoImpexEssentialData(new SystemSetupContext(Collections.EMPTY_MAP, Type.ESSENTIAL,
CuppyConstants.EXTENSIONNAME));
cuppySystemSetup.importBasics(new SystemSetupContext(Collections.singletonMap(CuppyConstants.PARAM_BASICS, new String[]
{ CuppyConstants.PARAM_BASICS_PLAYERS }), Type.NOTDEFINED, CuppyConstants.EXTENSIONNAME));
cuppySystemSetup.importWC2002(new SystemSetupContext(Collections.singletonMap(CuppyConstants.PARAM_WC2002, new String[]
{ CuppyConstants.PARAM_WC2002_SETUP, CuppyConstants.PARAM_WC2002_RESULTS_PRELIMINARIES,
CuppyConstants.PARAM_WC2002_RESULTS_FINALS, CuppyConstants.PARAM_WC2002_BETS_PRELIMINARIES,
CuppyConstants.PARAM_WC2002_BETS_FINALS }), Type.NOTDEFINED, CuppyConstants.EXTENSIONNAME));
LOG.info("Finished preparation of setup data");
LOG.info("Preparing session");
JaloSession.getCurrentSession().setUser(UserManager.getInstance().getUserByLogin("sternthaler"));
LOG.info("Finished preparation of session");
}
IntelliJ 将代码重新格式化为:
@Before
public void prepareData() throws Exception //NOPMD
{
LOG.info("Preparing setup data");
new CoreBasicDataCreator().createEssentialData(null, null);
CatalogManager.getInstance().createEssentialData(Collections.EMPTY_MAP, null);
serviceLayerDataSetup.createJobPerformables();
impExSystemSetup.createAutoImpexEssentialData(new SystemSetupContext(Collections.EMPTY_MAP, Type.ESSENTIAL,
CuppyConstants.EXTENSIONNAME));
cuppySystemSetup.importBasics(new SystemSetupContext(Collections.singletonMap(CuppyConstants.PARAM_BASICS, new String[]
{ CuppyConstants.PARAM_BASICS_PLAYERS }), Type.NOTDEFINED, CuppyConstants.EXTENSIONNAME));
cuppySystemSetup.importWC2002(new SystemSetupContext(Collections.singletonMap(CuppyConstants.PARAM_WC2002, new String[]
{ CuppyConstants.PARAM_WC2002_SETUP, CuppyConstants.PARAM_WC2002_RESULTS_PRELIMINARIES,
CuppyConstants.PARAM_WC2002_RESULTS_FINALS, CuppyConstants.PARAM_WC2002_BETS_PRELIMINARIES,
CuppyConstants.PARAM_WC2002_BETS_FINALS }), Type.NOTDEFINED, CuppyConstants.EXTENSIONNAME));
LOG.info("Finished preparation of setup data");
LOG.info("Preparing session");
JaloSession.getCurrentSession().setUser(UserManager.getInstance().getUserByLogin("sternthaler"));
LOG.info("Finished preparation of session");
}
如果您是 IntelliJ 用户,您可以在其代码样式编辑器中使用此代码示例。希望你们中的任何人都可以解决这个问题:)