Skip to content

Commit 0d20d7c

Browse files
committed
refactor(WorkspaceFileSearchPopup): cleanup unused imports
Remove unused imports for DataManager, SpeedSearchComparator, and other classes. Adjust popup size to 480x320 and change positioning method from showInBestPositionFor to showUnderneathOf.
1 parent 63ff29a commit 0d20d7c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/file/WorkspaceFileSearchPopup.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package cc.unitmesh.devti.gui.chat.ui.file
22

33
import cc.unitmesh.devti.util.canBeAdded
4-
import com.intellij.ide.DataManager
54
import com.intellij.openapi.fileEditor.impl.EditorHistoryManager
65
import com.intellij.openapi.project.Project
7-
import com.intellij.openapi.project.guessProjectDir
86
import com.intellij.openapi.roots.ProjectFileIndex
97
import com.intellij.openapi.ui.popup.JBPopup
108
import com.intellij.openapi.ui.popup.JBPopupFactory
@@ -14,8 +12,6 @@ import com.intellij.openapi.vfs.VirtualFile
1412
import com.intellij.openapi.wm.IdeFocusManager
1513
import com.intellij.ui.JBColor
1614
import com.intellij.ui.SearchTextField
17-
import com.intellij.ui.SpeedSearchComparator
18-
import com.intellij.ui.awt.RelativePoint
1915
import com.intellij.ui.components.JBLabel
2016
import com.intellij.ui.components.JBList
2117
import com.intellij.ui.components.JBScrollPane
@@ -25,7 +21,6 @@ import org.jetbrains.annotations.NotNull
2521
import java.awt.BorderLayout
2622
import java.awt.Component
2723
import java.awt.Dimension
28-
import java.awt.Point
2924
import java.awt.event.KeyAdapter
3025
import java.awt.event.KeyEvent
3126
import java.awt.event.MouseAdapter
@@ -45,7 +40,7 @@ class WorkspaceFileSearchPopup(
4540
private val searchField = SearchTextField()
4641
private val contentPanel = JPanel(BorderLayout())
4742
private val allProjectFiles = mutableListOf<FilePresentation>()
48-
private val minPopupSize = Dimension(500, 400)
43+
private val minPopupSize = Dimension(480, 320)
4944

5045
init {
5146
loadProjectFiles()
@@ -182,7 +177,7 @@ class WorkspaceFileSearchPopup(
182177
})
183178

184179
// Show popup in best position
185-
popup?.showInBestPositionFor(DataManager.getInstance().getDataContext(component))
180+
popup?.showUnderneathOf(component)
186181

187182
// Request focus for search field after popup is shown
188183
SwingUtilities.invokeLater {
@@ -192,7 +187,6 @@ class WorkspaceFileSearchPopup(
192187

193188
private inner class FileListCellRenderer : ListCellRenderer<FilePresentation> {
194189
private val noBorderFocus = BorderFactory.createEmptyBorder(1, 1, 1, 1)
195-
private val speedSearchComparator = SpeedSearchComparator(false)
196190

197191
@NotNull
198192
override fun getListCellRendererComponent(

0 commit comments

Comments
 (0)