Skip to content

Commit 0bc45e7

Browse files
committed
Print more
1 parent ea11c8c commit 0bc45e7

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<component id="org.eclipse.swt.gtk.linux.x86_64" version="2">
3-
<resource path="Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java" type="org.eclipse.swt.widgets.Composite">
4-
<filter id="576778288">
3+
<resource path="Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java" type="org.eclipse.swt.custom.BusyIndicator">
4+
<filter id="336658481">
55
<message_arguments>
6-
<message_argument value="Scrollable"/>
7-
<message_argument value="Composite"/>
6+
<message_argument value="org.eclipse.swt.custom.BusyIndicator"/>
7+
<message_argument value="onWake"/>
88
</message_arguments>
99
</filter>
1010
</resource>
1111
<resource path="Eclipse SWT/common/org/eclipse/swt/graphics/ImageDataAtSizeProvider.java" type="org.eclipse.swt.graphics.ImageDataAtSizeProvider">
12-
<filter id="403804204" comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable">
12+
<filter comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable" id="403804204">
1313
<message_arguments>
1414
<message_argument value="org.eclipse.swt.graphics.ImageDataAtSizeProvider"/>
1515
<message_argument value="getDefaultSize()"/>
1616
</message_arguments>
1717
</filter>
18-
<filter id="1211105284" comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable">
18+
<filter comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable" id="403804204">
1919
<message_arguments>
20-
<message_argument value="getDefaultSize()"/>
20+
<message_argument value="org.eclipse.swt.graphics.ImageDataAtSizeProvider"/>
21+
<message_argument value="getImageData(int, int)"/>
2122
</message_arguments>
2223
</filter>
23-
<filter id="403804204" comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable">
24+
<filter comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable" id="1211105284">
2425
<message_arguments>
25-
<message_argument value="org.eclipse.swt.graphics.ImageDataAtSizeProvider"/>
26-
<message_argument value="getImageData(int, int)"/>
26+
<message_argument value="getDefaultSize()"/>
2727
</message_arguments>
2828
</filter>
29-
<filter id="1211105284" comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable">
29+
<filter comment="Adding API filter to mark ImageDataAtSizeProvider as referenceable" id="1211105284">
3030
<message_arguments>
3131
<message_argument value="getImageData(int, int)"/>
3232
</message_arguments>

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.*;
1818
import java.util.concurrent.*;
1919
import java.util.concurrent.atomic.*;
20+
import java.util.function.*;
2021

2122
import org.eclipse.swt.*;
2223
import org.eclipse.swt.graphics.*;
@@ -33,6 +34,14 @@ public class BusyIndicator {
3334
private static final AtomicInteger nextBusyId = new AtomicInteger();
3435
static final String BUSYID_NAME = "SWT BusyIndicator"; //$NON-NLS-1$
3536
static final String BUSY_CURSOR = "SWT BusyIndicator Cursor"; //$NON-NLS-1$
37+
/**
38+
* @since 3.133
39+
*/
40+
public static Runnable onWake;
41+
/**
42+
* @since 3.133
43+
*/
44+
public static Consumer<Exception> onWakeError;
3645

3746
/**
3847
* Runs the given <code>Runnable</code> while providing
@@ -111,8 +120,14 @@ public static void showWhile(Future<?> future) {
111120
stage.handle((nil1, nil2) -> {
112121
if (!display.isDisposed()) {
113122
try {
123+
if (onWake!=null) {
124+
onWake.run();
125+
}
114126
display.wake();
115127
} catch (SWTException e) {
128+
if (onWakeError!=null) {
129+
onWakeError.accept(e);
130+
}
116131
// ignore then, this can happen due to the async nature between our check for
117132
// disposed and the actual call to wake the display can be disposed
118133
}

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ private static class SwtInternalStateTracker {
6969
volatile long lastSleepExitTime = 0;
7070

7171
SwtInternalStateTracker(Display display) {
72+
BusyIndicator.onWake = () -> logEvent("Called Wake from inside call");
73+
BusyIndicator.onWakeError = e -> logEvent("Error On wake "+e);
7274
this.display = display;
7375
initReflection();
7476
logEvent("SwtInternalStateTracker initialized");
@@ -213,6 +215,7 @@ private static class TestState {
213215
final AtomicBoolean asyncExec2Ran = new AtomicBoolean(false);
214216
final AtomicBoolean asyncExec3Ran = new AtomicBoolean(false);
215217

218+
216219
@Override
217220
public String toString() {
218221
StringBuilder sb = new StringBuilder();
@@ -387,6 +390,7 @@ public void testShowWhile() {
387390
tracker.logEvent("Test completed successfully");
388391
} finally {
389392
watchdog.cancel(false);
393+
state.swtTracker.printEventLog();
390394
}
391395
}
392396
}
@@ -454,7 +458,6 @@ public void testShowWhileWithFuture() {
454458
tracker.logEvent("About to call BusyIndicator.showWhile(future)");
455459
tracker.logEvent("State before showWhile: wake=" + tracker.getWakeFlag() + ", syncEmpty="
456460
+ tracker.isSynchronizerEmpty());
457-
458461
BusyIndicator.showWhile(future);
459462

460463
tracker.logEvent("BusyIndicator.showWhile(future) returned");
@@ -468,6 +471,7 @@ public void testShowWhileWithFuture() {
468471
tracker.logEvent("Test completed successfully");
469472
} finally {
470473
watchdog.cancel(false);
474+
state.swtTracker.printEventLog();
471475
}
472476
}
473477
}

0 commit comments

Comments
 (0)