private void queueColoringObjectsChangeEvent(Map<String, DynamicColorContribution> result) {
- if (result != null && !canvasContext.isDisposed()) {
- canvasContext.getDefaultHintContext().setHint(KEY_MAP_COLORING_OBJECTS, result);
- canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), MAP_COLORING_OBJECTS_CHANGE));
- } else {
- LOGGER.info("Result is either null or canvasContext is disposed", String.valueOf(result));
- }
+ queueEventInternal(KEY_MAP_COLORING_OBJECTS, MAP_COLORING_OBJECTS_CHANGE, result);
}
private void queueColorBarOptionsChangeEvent(ColorBarOptions result) {
- if (result != null && !canvasContext.isDisposed()) {
- canvasContext.getDefaultHintContext().setHint(KEY_MAP_COLOR_BAR_OPTIONS, result);
- canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), MAP_COLOR_BAR_OPTIONS_CHANGE));
- } else {
- LOGGER.info("Result is either null or canvasContext is disposed", String.valueOf(result));
- }
+ queueEventInternal(KEY_MAP_COLOR_BAR_OPTIONS, MAP_COLOR_BAR_OPTIONS_CHANGE, result);
}
private void queueSizingObjectsChangeEvent(Map<String, DynamicSizeContribution> result) {
- if (result != null && !canvasContext.isDisposed()) {
- canvasContext.getDefaultHintContext().setHint(KEY_MAP_SIZING_OBJECTS, result);
- canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), MAP_SIZING_OBJECTS_CHANGE));
- } else {
- LOGGER.info("Result is either null or canvasContext is disposed", String.valueOf(result));
- }
+ queueEventInternal(KEY_MAP_SIZING_OBJECTS, MAP_SIZING_OBJECTS_CHANGE, result);
}
private void queueSizeBarOptionsChangeEvent(SizeBarOptions result) {
+ queueEventInternal(KEY_MAP_SIZE_BAR_OPTIONS, MAP_SIZE_BAR_OPTIONS_CHANGE, result);
+ }
+
+ private void queueEventInternal(Key key, Command command, Object result) {
if (result != null && !canvasContext.isDisposed()) {
- canvasContext.getDefaultHintContext().setHint(KEY_MAP_SIZE_BAR_OPTIONS, result);
- canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), MAP_SIZE_BAR_OPTIONS_CHANGE));
+ canvasContext.getThreadAccess().asyncExec(() -> {
+ canvasContext.getDefaultHintContext().setHint(key, result);
+ canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), command));
+ });
} else {
LOGGER.info("Result is either null or canvasContext is disposed", String.valueOf(result));
}
}
-
+
private static class DrawMapEnabledRequest extends UnaryRead<Resource, Boolean> {
public DrawMapEnabledRequest(Resource diagram) {