Minor: remove unnecessary parameter

This commit is contained in:
Natalia Selezneva
2018-12-05 10:15:06 +03:00
parent b8007f1ee9
commit 84aef9cf2d
3 changed files with 4 additions and 4 deletions
@@ -49,9 +49,9 @@ fun TextEditor.addScratchPanel(panel: ScratchTopPanel) {
Disposer.register(this, panel)
}
fun TextEditor.removeScratchPanel(panel: ScratchTopPanel) {
fun TextEditor.removeScratchPanel() {
scratchTopPanel?.let { FileEditorManager.getInstance(it.scratchFile.project).removeTopComponent(this, it) }
scratchTopPanel = null
FileEditorManager.getInstance(panel.scratchFile.project).removeTopComponent(this, 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() {
getAllEditorsWithScratchPanel(project).forEach { (editor, panel) -> editor.removeScratchPanel(panel) }
getAllEditorsWithScratchPanel(project).forEach { (editor, _) -> editor.removeScratchPanel() }
}
private inner class ScratchEditorListener : FileEditorManagerListener {
@@ -44,7 +44,7 @@ import javax.swing.*
class ScratchTopPanel private constructor(val scratchFile: ScratchFile) : JPanel(HorizontalLayout(5)), Disposable {
override fun dispose() {
scratchFile.editor.removeScratchPanel(this)
scratchFile.editor.removeScratchPanel()
}
companion object {