Skip to content

Commit 75fcbff

Browse files
authored
Remove RxJava (#31)
2 parents 6a4fa5c + 01e6e6a commit 75fcbff

20 files changed

+72
-381
lines changed

.github/workflows/changelog-print.yml

-22
This file was deleted.

.github/workflows/gradle-wrapper-validation.yml

-23
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# gradle stuff
66
.gradle/
77
build/
8+
.kotlin/
89

910
# IntelliJ
1011
.idea

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## [Unreleased]
44
### Changed
5+
- **BREAKING** `SwtMisc.systemFontWidth` now returns `double` instead of `int`.
6+
- added new methods `systemFontWidthTimes(int)` and `systemFontWidthTimes(String)` to make this easier to deal with
7+
- **BREAKING** remove RxJava completely in favor of Kotlin Flow.
58
- Bump required java from 11 to 17.
69

710
## [4.3.1] - 2024-07-05

build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ subprojects { subProject ->
2525
"https://javadoc.io/doc/com.diffplug.durian/durian-concurrent/${VER_DURIAN}",
2626
"https://javadoc.io/doc/com.diffplug.durian/durian-debug/${VER_DURIAN_DEBUG}",
2727
"https://javadoc.io/doc/com.diffplug.durian/durian-rx/${VER_DURIAN_RX}",
28-
"https://javadoc.io/doc/io.reactivex.rxjava2/rxjava/${VER_RXJAVA}",
2928
'https://docs.oracle.com/javase/8/docs/api/'
3029
].join(' ')
3130

durian-swt/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ p2deps {
2222
dependencies {
2323
api project(':durian-swt.os')
2424
api "com.diffplug.durian:durian-rx:$VER_DURIAN_RX"
25-
api "io.reactivex.rxjava2:rxjava:$VER_RXJAVA"
2625
implementation "com.diffplug.durian:durian-core:$VER_DURIAN"
2726
implementation "com.diffplug.durian:durian-collect:$VER_DURIAN"
2827
implementation "com.diffplug.durian:durian-concurrent:$VER_DURIAN"

durian-swt/src/main/java/com/diffplug/common/swt/Shells.kt

+8-7
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import com.diffplug.common.swt.os.WS
2121
import com.diffplug.common.tree.TreeIterable
2222
import com.diffplug.common.tree.TreeQuery
2323
import com.diffplug.common.tree.TreeStream
24-
import io.reactivex.disposables.Disposable
25-
import io.reactivex.disposables.Disposables
24+
import kotlinx.coroutines.Job
2625
import org.eclipse.swt.SWT
2726
import org.eclipse.swt.graphics.Image
2827
import org.eclipse.swt.graphics.Point
@@ -36,7 +35,7 @@ import java.util.*
3635

3736
/** A fluent builder for creating SWT [Shell]s. */
3837
class Shells private constructor(private val style: Int, private val coat: Coat) {
39-
private var title: String = ""
38+
private var title: String? = null
4039
private var image: Image? = null
4140
private var alpha = SWT.DEFAULT
4241
private val size = Point(SWT.DEFAULT, SWT.DEFAULT)
@@ -434,17 +433,19 @@ class Shells private constructor(private val style: Int, private val coat: Coat)
434433

435434
/** Prevents the given shell from closing without prompting. Returns a Subscription which can cancel this blocking. */
436435
@JvmStatic
437-
fun confirmClose(shell: Shell, title: String, question: String, runOnClose: Runnable): Disposable {
436+
fun confirmClose(shell: Shell, title: String, question: String, runOnClose: Runnable): Job {
438437
val listener = Listener { e: Event ->
439438
e.doit = SwtMisc.blockForQuestion(title, question, shell)
440439
if (e.doit) {
441440
runOnClose.run()
442441
}
443442
}
444443
shell.addListener(SWT.Close, listener)
445-
return Disposables.fromRunnable {
446-
SwtExec.immediate().guardOn(shell).execute {
447-
shell.removeListener(SWT.Close, listener)
444+
return Job().apply {
445+
invokeOnCompletion {
446+
SwtExec.immediate().guardOn(shell).execute {
447+
shell.removeListener(SWT.Close, listener)
448+
}
448449
}
449450
}
450451
}

0 commit comments

Comments
 (0)