【发布时间】:2013-10-29 22:22:43
【问题描述】:
我已将一个项目从 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 用户,您可以在其代码样式编辑器中使用此代码示例。 希望你们中的任何人都可以解决这个问题:)
【问题讨论】:
-
你能描述一下 intellij 格式有什么问题吗?将代码放在这里很好,但最好完整地描述它而不是“完成工作”的问题......
-
我不太清楚如何描述它。唯一的问题是这个新的行数组标识(从那时的例子中可以看出)。我在 IntelliJ 中找不到相应的参数来设置这个
标签: java intellij-idea