Skip to content

Commit

Permalink
KT-10974 - small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gcx11 committed Apr 25, 2020
1 parent f688786 commit b7764e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ package org.jetbrains.kotlin.idea.core.formatter

import org.jetbrains.kotlin.resolve.ImportPath

data class KotlinPackageEntry(
val packageName: String,
class KotlinPackageEntry(
packageName: String,
val withSubpackages: Boolean
) {
val packageName = packageName.removeSuffix(".*")

companion object {
@JvmField
val ALL_OTHER_IMPORTS_ENTRY = KotlinPackageEntry("<all other imports>", withSubpackages = true)
Expand Down Expand Up @@ -45,9 +47,10 @@ data class KotlinPackageEntry(
return entry.packageName.count { it == '.' } < packageName.count { it == '.' }
}

val isSpecial: Boolean get() {
return (this == ALL_OTHER_IMPORTS_ENTRY || this == ALL_OTHER_ALIAS_IMPORTS_ENTRY)
}
val isSpecial: Boolean
get() {
return (this == ALL_OTHER_IMPORTS_ENTRY || this == ALL_OTHER_ALIAS_IMPORTS_ENTRY)
}

override fun toString(): String {
return packageName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.intellij.openapi.application.ApplicationBundle
import com.intellij.openapi.wm.IdeFocusManager
import com.intellij.ui.*
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.layout.selected
import com.intellij.ui.table.JBTable
import com.intellij.util.IconUtil
import com.intellij.util.ui.JBUI
Expand Down Expand Up @@ -292,7 +291,7 @@ fun createTableForPackageEntries(packageTable: KotlinPackageEntryTable): JBTable
override fun getColumnClass(columnIndex: Int): Class<*> {
return when (columnIndex) {
0 -> String::class.java
1 -> Boolean::class.java
1 -> Boolean::class.javaObjectType
else -> throw IllegalArgumentException(columnIndex.toString())
}
}
Expand All @@ -302,7 +301,7 @@ fun createTableForPackageEntries(packageTable: KotlinPackageEntryTable): JBTable

val newEntry = when (columnIndex) {
0 -> KotlinPackageEntry((value as String).trim(), entry.withSubpackages)
1 -> KotlinPackageEntry(entry.packageName, (value as Boolean))
1 -> KotlinPackageEntry(entry.packageName, value.toString().toBoolean())
else -> throw IllegalArgumentException(columnIndex.toString())
}

Expand Down

0 comments on commit b7764e9

Please sign in to comment.