-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc908bd
commit 3ae1fec
Showing
5 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
plot-config/src/jvmMain/kotlin/plot/AwtContainerDisposer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2021. JetBrains s.r.o. | ||
* Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
*/ | ||
|
||
package jetbrains.datalore.plot | ||
|
||
import jetbrains.datalore.base.registration.Disposable | ||
import java.awt.Container | ||
|
||
class AwtContainerDisposer( | ||
private val container: Container | ||
) : Disposable { | ||
private var isDisposed: Boolean = false | ||
|
||
override fun dispose() { | ||
require(!isDisposed) { "Already disposed." } | ||
isDisposed = true | ||
container.components.forEach { | ||
// We expect all children are disposable | ||
(it as Disposable).dispose() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters