Skip to content

Commit

Permalink
Remove RxJava (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Jan 25, 2025
2 parents 6a4fa5c + 01e6e6a commit 75fcbff
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 381 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/changelog-print.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# gradle stuff
.gradle/
build/
.kotlin/

# IntelliJ
.idea
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

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

## [4.3.1] - 2024-07-05
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ subprojects { subProject ->
"https://javadoc.io/doc/com.diffplug.durian/durian-concurrent/${VER_DURIAN}",
"https://javadoc.io/doc/com.diffplug.durian/durian-debug/${VER_DURIAN_DEBUG}",
"https://javadoc.io/doc/com.diffplug.durian/durian-rx/${VER_DURIAN_RX}",
"https://javadoc.io/doc/io.reactivex.rxjava2/rxjava/${VER_RXJAVA}",
'https://docs.oracle.com/javase/8/docs/api/'
].join(' ')

Expand Down
1 change: 0 additions & 1 deletion durian-swt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ p2deps {
dependencies {
api project(':durian-swt.os')
api "com.diffplug.durian:durian-rx:$VER_DURIAN_RX"
api "io.reactivex.rxjava2:rxjava:$VER_RXJAVA"
implementation "com.diffplug.durian:durian-core:$VER_DURIAN"
implementation "com.diffplug.durian:durian-collect:$VER_DURIAN"
implementation "com.diffplug.durian:durian-concurrent:$VER_DURIAN"
Expand Down
15 changes: 8 additions & 7 deletions durian-swt/src/main/java/com/diffplug/common/swt/Shells.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import com.diffplug.common.swt.os.WS
import com.diffplug.common.tree.TreeIterable
import com.diffplug.common.tree.TreeQuery
import com.diffplug.common.tree.TreeStream
import io.reactivex.disposables.Disposable
import io.reactivex.disposables.Disposables
import kotlinx.coroutines.Job
import org.eclipse.swt.SWT
import org.eclipse.swt.graphics.Image
import org.eclipse.swt.graphics.Point
Expand All @@ -36,7 +35,7 @@ import java.util.*

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

/** Prevents the given shell from closing without prompting. Returns a Subscription which can cancel this blocking. */
@JvmStatic
fun confirmClose(shell: Shell, title: String, question: String, runOnClose: Runnable): Disposable {
fun confirmClose(shell: Shell, title: String, question: String, runOnClose: Runnable): Job {
val listener = Listener { e: Event ->
e.doit = SwtMisc.blockForQuestion(title, question, shell)
if (e.doit) {
runOnClose.run()
}
}
shell.addListener(SWT.Close, listener)
return Disposables.fromRunnable {
SwtExec.immediate().guardOn(shell).execute {
shell.removeListener(SWT.Close, listener)
return Job().apply {
invokeOnCompletion {
SwtExec.immediate().guardOn(shell).execute {
shell.removeListener(SWT.Close, listener)
}
}
}
}
Expand Down
Loading

0 comments on commit 75fcbff

Please sign in to comment.