Java: add "Layout on-demand import from the same package first" option (IDEA-204441)

enabled by default for consistency with other tools

(cherry picked from commit df5a4b65c5f31b195bd091a91d16ea0bc7bcc36c)

GitOrigin-RevId: 3b669ce15e9ad037bcff9c1e2638e2b823424ef7
This commit is contained in:
Bas Leijdekkers
2024-10-22 20:10:14 +02:00
committed by intellij-monorepo-bot
parent f4cdf03f94
commit 2ec44412eb
12 changed files with 108 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.psi.codeStyle;
import com.intellij.application.options.CodeStyle;
@@ -57,7 +57,7 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
public boolean GENERATE_FINAL_PARAMETERS;
@PsiModifier.ModifierConstant
public String VISIBILITY = "public";
public String VISIBILITY = PsiModifier.PUBLIC;
public boolean USE_EXTERNAL_ANNOTATIONS;
public boolean GENERATE_USE_TYPE_ANNOTATION_BEFORE_TYPE = true;
@@ -170,6 +170,7 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
// Imports
public boolean LAYOUT_STATIC_IMPORTS_SEPARATELY = true;
public boolean LAYOUT_ON_DEMAND_IMPORT_FROM_SAME_PACKAGE_FIRST = true;
public boolean USE_FQ_CLASS_NAMES;
public boolean USE_SINGLE_CLASS_IMPORTS = true;
public boolean INSERT_INNER_CLASS_IMPORTS;
@@ -288,7 +289,16 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
@Override
public void setLayoutStaticImportsSeparately(boolean value) {
LAYOUT_STATIC_IMPORTS_SEPARATELY = value;
}
@Override
public boolean isLayoutOnDemandImportFromSamePackageFirst() {
return LAYOUT_ON_DEMAND_IMPORT_FROM_SAME_PACKAGE_FIRST;
}
@Override
public void setLayoutOnDemandImportFromSamePackageFirst(boolean value) {
this.LAYOUT_ON_DEMAND_IMPORT_FROM_SAME_PACKAGE_FIRST = value;
}
@Override