Skip to content

Commit

Permalink
#5 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmkah committed Sep 21, 2019
1 parent f73ade7 commit c632e3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ patchPluginXml {
<ul>
<li>0.7.0
<ul>
<li><a href="https://github.com/ehmkah/imgdiff/issues/24">issue/24</a> (bugfix: fixed memory leak)</li>
<li><a href="https://github.com/ehmkah/imgdiff/issues/22">issue/22</a> (technical: upgrade used kotlin and intellij gradle-plugin)</li>
</ul>
</li>
Expand Down
18 changes: 7 additions & 11 deletions src/main/kotlin/de/ehmkah/projects/imgdiff/ImdDiffDialogWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.intellij.openapi.ui.DialogWrapper
import org.intellij.images.editor.impl.ImageEditorManagerImpl
import java.awt.BorderLayout
import java.awt.image.BufferedImage
import java.util.*
import javax.swing.JComponent
import javax.swing.JPanel

Expand All @@ -17,28 +16,25 @@ import javax.swing.JPanel
*/
class ImdDiffDialogWrapper(val bufferedImage: BufferedImage) : DialogWrapper(true) {

val result = LinkedList<JPanel>()
lateinit var editorForCleanup: Disposable

init {
init()
title = "ImgDiff"
}

override fun createCenterPanel(): JComponent? {
result.add(JPanel(BorderLayout()))
val result = JPanel(BorderLayout())
val jPanel = ImageEditorManagerImpl.createImageEditorUI(bufferedImage)
result.get(0).add(jPanel, BorderLayout.CENTER)
return result.get(0)
editorForCleanup = jPanel
result.add(jPanel, BorderLayout.CENTER)

return result
}

// ImageEditorUI
override fun dispose() {
super.dispose()
val component = result.get(0).getComponent(0)
if (component is Disposable) {
component.dispose();
}
result.get(0).removeAll()
editorForCleanup.dispose()
}
}

0 comments on commit c632e3c

Please sign in to comment.