Removed ImportPackage UI settings

This commit is contained in:
Stanislav Erokhin
2015-09-18 17:33:05 +03:00
parent 1360f3cd43
commit d7a14075f1
6 changed files with 2 additions and 15 deletions
@@ -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();
@@ -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()
@@ -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
@@ -1,5 +1,3 @@
// IMPORT_PACKAGES: false
fun foo(array: Array<String>){}
val v: <selection>java.lang.reflect.Array</selection>
@@ -1,5 +1,3 @@
// IMPORT_PACKAGES: false
fun foo(array: Array<String>){}
val v: java.lang.reflect.Array
@@ -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 {