The binaries are available on Bintray: https://dl.bintray.com/simon-scholz/RxJava-Extensions/
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/simon-scholz/RxJava-Extensions/'
}
}
dependencies {
compile 'io.reactivex.swt:rxswt:0.1.0'
// other dependencies ...
}
<repositories>
<repository>
<id>RxExtensions</id>
<url>https://dl.bintray.com/simon-scholz/RxJava-Extensions/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.reactivex.swt</groupId>
<artifactId>rxswt</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
Since for Eclipse RCP development SWT is mainly used as UI toolkit it is likely that you’ll want to obtain RxJava and RxSWT from a P2 update site.
A P2 update site is available here: https://dl.bintray.com/simon-scholz/RxJava-OSGi/
A sample project containing an Eclipse 4 sample application using RxJava and RxSWT can be found here: rxjava-osgi
A sample SWT application is part of this Git repository. See Building to run the sample application.
But there is also a rxjava-osgi repo, which contains the build for a p2 updatesite and a Sample Eclipse 4 application using RxJava 2 and RxSWT.
Using the RxSWT Scheduler
is fairly simple.
Observable.create(emitter -> {
// ... do some heaving processing, which shouldn't be done on the main thread
}).subscribeOn(Schedulers.io())
.observeOn(SwtSchedulers.currentDisplayThread())
.subscribe(System.out::println, Throwable::printStackTrace);
Besides using the current Display
, the default Display
or a user defined Display
can be used:
Display display = new Display();
Observable.create(emitter -> {
// ... do some heaving processing, which shouldn't be done on the main thread
}).subscribeOn(Schedulers.io())
.observeOn(SwtSchedulers.from(display))
.subscribe(System.out::println, Throwable::printStackTrace);
The code can simply be cloned from GitHub by using the command line:
# Using HTTPS
$ git clone https://github.com/SimonScholz/RxSWT.git
# Using SSH
$ git clone git@github.com:SimonScholz/RxSWT.git
Or you can use your favorite Git tooling, e.g., EGit Eclipse Git integration.
Unlike many other Eclipse related project Gradle is being used instead of Maven Tycho.
$ cd RxSWT
$ ./gradlew build
Besides just building the projects you can also directly run the sample application by using the run
task:
$ cd RxSWT
$ ./gradlew run
In order to use and run the code in the Eclipse IDE you need to install the Buildship tooling by either using the update site or a market place installation.
Buildship contributes a Gradle Import Wizard to the Eclipse Import Wizards, which can be used to import the RxSWT project.
Once the projects are imported you can play around, modify it or run the sample App
.
Feedback and contributions are highly appreciated. So please do not hesitate to open issues or fork this repo and provide pull requests.
I am also available on Twitter @simonscholz
Copyright (c) 2017-present, RxSWT Contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.