Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,11 @@ private void updateSelection(final SerializableConsumer<Collection<T>> handler,

// TODO selection is private, have to use reflection (remove later)
try {
final Field f1 = getSelectionBaseClass().getDeclaredField("selection");
final Field f1 = getFieldRecursive(this.getClass(), "selection");
f1.setAccessible(true);
f1.set(this, selection);
}
catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}

Expand All @@ -877,6 +877,17 @@ private void updateSelection(final SerializableConsumer<Collection<T>> handler,

getDataProvider().refreshAll();
}

protected Field getFieldRecursive(Class clazz, String name) {
if(clazz == null) {
return null;
}
try {
return clazz.getDeclaredField(name);
} catch(NoSuchFieldException | SecurityException | IllegalArgumentException e) {
return getFieldRecursive(clazz.getSuperclass(), name);
}
}

protected Class<?> getSelectionBaseClass() {
return this.getClass()
Expand Down