diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/formatter/JetCodeStyleSettings.java b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/formatter/JetCodeStyleSettings.java index 5e958e7a2b0..a4853e1e1ac 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/formatter/JetCodeStyleSettings.java +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/formatter/JetCodeStyleSettings.java @@ -43,7 +43,6 @@ public class JetCodeStyleSettings extends CustomCodeStyleSettings { public boolean LBRACE_ON_NEXT_LINE = false; public int NAME_COUNT_TO_USE_STAR_IMPORT = ApplicationManager.getApplication().isUnitTestMode() ? Integer.MAX_VALUE : 5; - public boolean IMPORT_PACKAGES = true; public boolean IMPORT_NESTED_CLASSES = false; public final PackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new PackageEntryTable(); diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/ImportSettingsPanel.kt b/idea/src/org/jetbrains/kotlin/idea/formatter/ImportSettingsPanel.kt index a87b3b4802f..526ee87e95b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/ImportSettingsPanel.kt +++ b/idea/src/org/jetbrains/kotlin/idea/formatter/ImportSettingsPanel.kt @@ -19,7 +19,6 @@ package org.jetbrains.kotlin.idea.formatter import com.intellij.application.options.CodeStyleAbstractPanel import com.intellij.application.options.ImportLayoutPanel import com.intellij.application.options.PackagePanel -import com.intellij.ide.highlighter.JavaFileType import com.intellij.openapi.application.ApplicationBundle import com.intellij.openapi.editor.colors.EditorColorsScheme import com.intellij.psi.codeStyle.CodeStyleSettings @@ -68,7 +67,6 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane private val starImportLimitModel = SpinnerNumberModel(4, 1, 100, 1) private val starImportLimitField = JSpinner(starImportLimitModel) private val cbImportNestedClasses = JCheckBox("Insert imports for nested classes") - private val cbImportPackages = JCheckBox("Insert imports for packages") private val starImportPackageEntryTable = PackageEntryTable() private val dummyImportLayoutPanel = object : ImportLayoutPanel() { @@ -121,7 +119,6 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane }, true) add(cbImportNestedClasses) - add(cbImportPackages) }.createPanel() } @@ -138,7 +135,6 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane } cbImportNestedClasses.setSelected(settings.IMPORT_NESTED_CLASSES) - cbImportPackages.setSelected(settings.IMPORT_PACKAGES) starImportPackageEntryTable.copyFrom(settings.PACKAGES_TO_USE_STAR_IMPORTS) (starImportPackageTable.getModel() as AbstractTableModel).fireTableDataChanged() @@ -154,7 +150,6 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane else -> (starImportLimitModel.getNumber() as Int) + 1 } settings.IMPORT_NESTED_CLASSES = cbImportNestedClasses.isSelected() - settings.IMPORT_PACKAGES = cbImportPackages.isSelected() if (dropEmptyPackages) { starImportPackageEntryTable.removeEmptyPackages() diff --git a/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt b/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt index 73ed93f0169..5789b8ae563 100644 --- a/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt +++ b/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt @@ -89,7 +89,7 @@ public class ImportInsertHelperImpl(private val project: Project) : ImportInsert override fun mayImportByCodeStyle(descriptor: DeclarationDescriptor): Boolean { val importable = descriptor.getImportableDescriptor() return when (importable) { - is PackageViewDescriptor -> codeStyleSettings.IMPORT_PACKAGES + is PackageViewDescriptor -> false // now package cannot be imported is ClassDescriptor -> { importable.getContainingDeclaration() is PackageFragmentDescriptor diff --git a/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt b/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt index fa2247c65ad..e1ae0ff52d0 100644 --- a/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt +++ b/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt @@ -1,5 +1,3 @@ -// IMPORT_PACKAGES: false - fun foo(array: Array){} val v: java.lang.reflect.Array \ No newline at end of file diff --git a/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt.after b/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt.after index 9e3f2c8c62a..271f9dd56b1 100644 --- a/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt.after +++ b/idea/testData/shortenRefs/ClassNameConflictNoPackageImport.kt.after @@ -1,5 +1,3 @@ -// IMPORT_PACKAGES: false - fun foo(array: Array){} val v: java.lang.reflect.Array \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/AbstractImportsTest.kt b/idea/tests/org/jetbrains/kotlin/AbstractImportsTest.kt index 14528a588ca..56321a35db5 100644 --- a/idea/tests/org/jetbrains/kotlin/AbstractImportsTest.kt +++ b/idea/tests/org/jetbrains/kotlin/AbstractImportsTest.kt @@ -16,13 +16,11 @@ package org.jetbrains.kotlin -import com.intellij.codeInsight.CodeInsightSettings import com.intellij.psi.codeStyle.CodeStyleSettingsManager import com.intellij.psi.codeStyle.PackageEntry -import org.jdom.Element +import org.jetbrains.kotlin.idea.core.formatter.JetCodeStyleSettings import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.JetWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.idea.core.formatter.JetCodeStyleSettings import org.jetbrains.kotlin.idea.util.application.executeWriteCommand import org.jetbrains.kotlin.psi.JetFile import org.jetbrains.kotlin.test.InTextDirectivesUtils @@ -58,7 +56,6 @@ public abstract class AbstractImportsTest : JetLightCodeInsightFixtureTestCase() val fileText = file.getText() codeStyleSettings.NAME_COUNT_TO_USE_STAR_IMPORT = InTextDirectivesUtils.getPrefixedInt(fileText, "// NAME_COUNT_TO_USE_STAR_IMPORT:") ?: nameCountToUseStarImportDefault - codeStyleSettings.IMPORT_PACKAGES = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// IMPORT_PACKAGES:") ?: true codeStyleSettings.IMPORT_NESTED_CLASSES = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// IMPORT_NESTED_CLASSES:") ?: false InTextDirectivesUtils.findLinesWithPrefixesRemoved(fileText, "// PACKAGE_TO_USE_STAR_IMPORTS:").forEach {