Minor: remove unnecessary parameter
This commit is contained in:
@@ -49,9 +49,9 @@ fun TextEditor.addScratchPanel(panel: ScratchTopPanel) {
|
|||||||
Disposer.register(this, panel)
|
Disposer.register(this, panel)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TextEditor.removeScratchPanel(panel: ScratchTopPanel) {
|
fun TextEditor.removeScratchPanel() {
|
||||||
|
scratchTopPanel?.let { FileEditorManager.getInstance(it.scratchFile.project).removeTopComponent(this, it) }
|
||||||
scratchTopPanel = null
|
scratchTopPanel = null
|
||||||
FileEditorManager.getInstance(panel.scratchFile.project).removeTopComponent(this, panel)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var TextEditor.scratchTopPanel: ScratchTopPanel? by UserDataProperty<TextEditor, ScratchTopPanel>(Key.create("scratch.panel"))
|
private var TextEditor.scratchTopPanel: ScratchTopPanel? by UserDataProperty<TextEditor, ScratchTopPanel>(Key.create("scratch.panel"))
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class ScratchFileHook(val project: Project) : ProjectComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun projectClosed() {
|
override fun projectClosed() {
|
||||||
getAllEditorsWithScratchPanel(project).forEach { (editor, panel) -> editor.removeScratchPanel(panel) }
|
getAllEditorsWithScratchPanel(project).forEach { (editor, _) -> editor.removeScratchPanel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class ScratchEditorListener : FileEditorManagerListener {
|
private inner class ScratchEditorListener : FileEditorManagerListener {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import javax.swing.*
|
|||||||
|
|
||||||
class ScratchTopPanel private constructor(val scratchFile: ScratchFile) : JPanel(HorizontalLayout(5)), Disposable {
|
class ScratchTopPanel private constructor(val scratchFile: ScratchFile) : JPanel(HorizontalLayout(5)), Disposable {
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
scratchFile.editor.removeScratchPanel(this)
|
scratchFile.editor.removeScratchPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user