2
2
3
3
<!-- -freshmark shields
4
4
output = [
5
- link(shield('Maven artifact', 'mavenCentral', '{{group}}:{{name}} ', 'blue'), 'https://bintray.com/{{org}} /opensource/{{name}} /view'),
6
- link(shield('Latest version', 'latest', '{{stable }}', 'blue'), 'https://github.com/{{org}}/{{name}} /releases/latest'),
7
- link(shield('Javadoc', 'javadoc', 'OK', 'blue'), 'https://{{org}} .github.io/{{name}} /javadoc/{{stable }}/'),
8
- link(shield('License Apache', 'license', 'Apache', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),
9
- '',
10
- link(shield('Changelog', 'changelog', '{{version }}', 'brightgreen'), 'CHANGES.md'),
11
- link(image('Travis CI', 'https://travis-ci.org/{{org}}/{{name}} .svg?branch=master'), 'https://travis-ci.org/{{org}}/{{name}} '),
12
- link(shield('Live chat', 'gitter', 'live chat', 'brightgreen'), 'https://gitter.im/diffplug/durian')
13
- ].join('\n');
5
+ link(shield('Maven artifact', 'mavenCentral', 'com.diffplug.durian:durian-swt ', 'blue'), 'https://bintray.com/diffplug /opensource/durian-swt /view'),
6
+ link(shield('Latest version', 'latest', '{{versionLast }}', 'blue'), 'https://github.com/diffplug/durian-swt /releases/latest'),
7
+ link(shield('Javadoc', 'javadoc', 'OK', 'blue'), 'https://diffplug .github.io/durian-swt /javadoc/{{versionLast }}/'),
8
+ link(shield('License Apache', 'license', 'Apache', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),
9
+ '',
10
+ link(shield('Changelog', 'changelog', '{{versionLast }}', 'brightgreen'), 'CHANGES.md'),
11
+ link(image('Travis CI', 'https://travis-ci.org/diffplug/durian-swt .svg?branch=master'), 'https://travis-ci.org/diffplug/durian-swt '),
12
+ link(shield('Live chat', 'gitter', 'live chat', 'brightgreen'), 'https://gitter.im/diffplug/durian')
13
+ ].join('\n');
14
14
-->
15
15
[ ![ Maven artifact] ( https://img.shields.io/badge/mavenCentral-com.diffplug.durian%3Adurian--swt-blue.svg )] ( https://bintray.com/diffplug/opensource/durian-swt/view )
16
16
[ ![ Latest version] ( https://img.shields.io/badge/latest-3.3.0-blue.svg )] ( https://github.com/diffplug/durian-swt/releases/latest )
17
17
[ ![ Javadoc] ( https://img.shields.io/badge/javadoc-OK-blue.svg )] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/ )
18
18
[ ![ License Apache] ( https://img.shields.io/badge/license-Apache-blue.svg )] ( https://tldrlegal.com/license/apache-license-2.0-(apache-2.0) )
19
19
20
- [ ![ Changelog] ( https://img.shields.io/badge/changelog-3.4.0--SNAPSHOT -brightgreen.svg )] ( CHANGES.md )
20
+ [ ![ Changelog] ( https://img.shields.io/badge/changelog-3.3.0 -brightgreen.svg )] ( CHANGES.md )
21
21
[ ![ Travis CI] ( https://travis-ci.org/diffplug/durian-swt.svg?branch=master )] ( https://travis-ci.org/diffplug/durian-swt )
22
22
[ ![ Live chat] ( https://img.shields.io/badge/gitter-live_chat-brightgreen.svg )] ( https://gitter.im/diffplug/durian )
23
23
<!-- -freshmark /shields -->
24
24
25
25
<!-- -freshmark javadoc
26
- output = prefixDelimiterReplace(input, 'https://{{org}} .github.io/{{name}} /javadoc/', '/', stable );
26
+ output = prefixDelimiterReplace(input, 'https://diffplug .github.io/durian-swt /javadoc/', '/', versionLast );
27
27
-->
28
28
### Infrastructure
29
29
@@ -35,7 +35,7 @@ output = prefixDelimiterReplace(input, 'https://{{org}}.github.io/{{name}}/javad
35
35
36
36
``` java
37
37
SwtExec . async(). guardOn(textBox). subscribe(serverResponse, txt - > {
38
- textBox. setText(txt);
38
+ textBox. setText(txt);
39
39
});
40
40
```
41
41
@@ -45,28 +45,28 @@ SwtExec.async().guardOn(textBox).subscribe(serverResponse, txt -> {
45
45
46
46
``` java
47
47
void textOkCanel(Composite cmp) {
48
- Layouts . setGrid(cmp). numColumns(3 );
49
-
50
- // instructions fill the full width
51
- Text text = new Text (cmp, SWT. WRAP );
52
- Layouts . setGridData(text). horizontalSpan(3 ). grabAll();
53
-
54
- // right-justified ok / cancel buttons
55
- Layouts . newGridPlaceholder(cmp). grabHorizontal();
56
- Button btnOk = new Button (cmp, SWT. PUSH );
57
- Layouts . setGridData(btn). widthHint(SwtMisc . defaultButtonWidth());
58
- Button btnCancel = new Button (cmp, SWT. PUSH );
59
- Layouts . setGridData(btn). widthHint(SwtMisc . defaultButtonWidth());
48
+ Layouts . setGrid(cmp). numColumns(3 );
49
+
50
+ // instructions fill the full width
51
+ Text text = new Text (cmp, SWT. WRAP );
52
+ Layouts . setGridData(text). horizontalSpan(3 ). grabAll();
53
+
54
+ // right-justified ok / cancel buttons
55
+ Layouts . newGridPlaceholder(cmp). grabHorizontal();
56
+ Button btnOk = new Button (cmp, SWT. PUSH );
57
+ Layouts . setGridData(btn). widthHint(SwtMisc . defaultButtonWidth());
58
+ Button btnCancel = new Button (cmp, SWT. PUSH );
59
+ Layouts . setGridData(btn). widthHint(SwtMisc . defaultButtonWidth());
60
60
}
61
61
```
62
62
63
63
* [ ` Shells ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/Shells.html ) - dialogs without boilerplate
64
64
65
65
``` java
66
66
Shells . builder(SWT. DIALOG_TRIM , this :: textOkCanel)
67
- .setTitle(" Confirm operation" )
68
- .setSize(SwtMisc . defaultDialogWidth(), 0 ) // set the width, pack height to fit contents
69
- .openOnDisplayBlocking();
67
+ .setTitle(" Confirm operation" )
68
+ .setSize(SwtMisc . defaultDialogWidth(), 0 ) // set the width, pack height to fit contents
69
+ .openOnDisplayBlocking();
70
70
```
71
71
72
72
* [ ` Actions ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/jface/Actions.html ) - builder and one-liner:
@@ -109,45 +109,45 @@ From [`ViewerMiscTest.java`](https://github.com/diffplug/durian-swt/blob/master/
109
109
110
110
``` java
111
111
String message = StringPrinter . buildStringFromLines(
112
- " - The table and the tree should keep their selection in sync." ,
113
- " - The table and the tree should not allow multi-selection." ,
114
- " - The categories in the tree should not be selectable." );
112
+ " - The table and the tree should keep their selection in sync." ,
113
+ " - The table and the tree should not allow multi-selection." ,
114
+ " - The categories in the tree should not be selectable." );
115
115
InteractiveTest . testCoat(message, cmp - > {
116
- TableAndTree tableAndTree = new TableAndTree (cmp, SWT. SINGLE );
116
+ TableAndTree tableAndTree = new TableAndTree (cmp, SWT. SINGLE );
117
117
118
- // get the selection of the tree
119
- RxBox<Optional<TreeNode<String > > > treeSelection = ViewerMisc . < TreeNode<String > > singleSelection(tableAndTree. tree)
120
- // only names can be selected - not categories
121
- .enforce(opt - > opt. map(val - > isName(val) ? val : null ));
118
+ // get the selection of the tree
119
+ RxBox<Optional<TreeNode<String > > > treeSelection = ViewerMisc . < TreeNode<String > > singleSelection(tableAndTree. tree)
120
+ // only names can be selected - not categories
121
+ .enforce(opt - > opt. map(val - > isName(val) ? val : null ));
122
122
123
- // sync the tree and the table
124
- RxOptional<TreeNode<String > > tableSelection = ViewerMisc . singleSelection(tableAndTree. table);
125
- Rx . subscribe(treeSelection, tableSelection:: set);
126
- Rx . subscribe(tableSelection, treeSelection:: set);
123
+ // sync the tree and the table
124
+ RxOptional<TreeNode<String > > tableSelection = ViewerMisc . singleSelection(tableAndTree. table);
125
+ Rx . subscribe(treeSelection, tableSelection:: set);
126
+ Rx . subscribe(tableSelection, treeSelection:: set);
127
127
});
128
128
```
129
129
130
130
### Miscellaneous stuff
131
131
132
132
* [ ` SwtMisc ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/SwtMisc.html ) - useful static methods.
133
- + `blockForError`, `blockForSuccess`, `blockForQuestion`, etc. - opens a dialog and blocks for the user's response, can be called from any thread.
134
- + `loopUntil`, `loopUntilDisposed`, `loopUntilGet` - spins the SWT display loop until some condition is satisfied.
135
- + `systemFontHeight/Width`, `scaleByFont`, `scaleByFontHeight` - resolution-independent sizes.
136
- + `treeDefControl`, `treeDefComposite` - a [`TreeDef`](http://diffplug.github.io/durian/javadoc/snapshot/com/diffplug/common/base/TreeDef.html) for traversing UI elements.
137
- + `setEnabledDeep` - sets the enabled status of every child, grandchild, etc. of the given composite.
133
+ + ` blockForError ` , ` blockForSuccess ` , ` blockForQuestion ` , etc. - opens a dialog and blocks for the user's response, can be called from any thread.
134
+ + ` loopUntil ` , ` loopUntilDisposed ` , ` loopUntilGet ` - spins the SWT display loop until some condition is satisfied.
135
+ + ` systemFontHeight/Width ` , ` scaleByFont ` , ` scaleByFontHeight ` - resolution-independent sizes.
136
+ + ` treeDefControl ` , ` treeDefComposite ` - a [ ` TreeDef ` ] ( http://diffplug.github.io/durian/javadoc/snapshot/com/diffplug/common/base/TreeDef.html ) for traversing UI elements.
137
+ + ` setEnabledDeep ` - sets the enabled status of every child, grandchild, etc. of the given composite.
138
138
* [ ` SwtRx ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/SwtRx.html ) - methods for converting SWT events and models to RxJava Observables.
139
139
* [ ` SwtDebug ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/SwtDebug.html ) - utilities for debugging SWT events.
140
140
* [ ` OS ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/os/OS.html ) , [ ` Arch ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/os/Arch.html ) , and [ ` SwtPlatform ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/os/SwtPlatform.html ) - detect things about the running system, and manipulate the SWT jars for build tools.
141
- + These do not require SWT or JFace, so you can add DurianSwt to your gradle or maven dependencies without needing to also figure out the SWT messiness.
142
- + You can also just copy-paste these straight into your own code - they have no external dependencies.
141
+ + These do not require SWT or JFace, so you can add DurianSwt to your gradle or maven dependencies without needing to also figure out the SWT messiness.
142
+ + You can also just copy-paste these straight into your own code - they have no external dependencies.
143
143
``` java
144
144
String installerExtension = OS . getNative(). winMacLinux(" exe" ," dmg" ," sh" );
145
145
String helperBinary = " driver_" + Arch . getNative(). x86x64(" " , " _64" ) + " .dll" ;
146
146
String swtJarName = " org.eclipse.swt." + SwtPlatform . getRunning();
147
147
```
148
148
* [ ` ViewerMisc ` ] ( https://diffplug.github.io/durian-swt/javadoc/3.3.0/com/diffplug/common/swt/jface/ViewerMisc.html ) - useful static methods for JFace viewers.
149
- + `singleSelection`, `multiSelection` - returns an RxBox for listening to and setting the selection of a viewer.
150
- + `setTreeContentProvider`, `setLazyTreeContentProvider` - uses a TreeDef to provide the content of a TreeViewer.
149
+ + ` singleSelection ` , ` multiSelection ` - returns an RxBox for listening to and setting the selection of a viewer.
150
+ + ` setTreeContentProvider ` , ` setLazyTreeContentProvider ` - uses a TreeDef to provide the content of a TreeViewer.
151
151
152
152
<!-- -freshmark /javadoc -->
153
153
@@ -158,7 +158,7 @@ Durian requires:
158
158
* [ Durian] ( https://github.com/diffplug/durian ) and [ DurianRx] ( https://github.com/diffplug/durian-rx )
159
159
* [ Guava] ( https://github.com/google/guava ) and [ RxJava] ( https://github.com/reactivex/rxjava )
160
160
* SWT and JFace from Eclipse 4.4+
161
- + SWT and JFace are not included in the Maven POM, but everything else is.
161
+ + SWT and JFace are not included in the Maven POM, but everything else is.
162
162
163
163
## Acknowledgements
164
164
0 commit comments