boolean isAnonymous();
/**
- * Send an event to this topic. Does noothing by default., but if implemented it
+ * Send an event to this topic. Does nothing by default., but if implemented it
* MUST set the {@link #CMS_VIEW_UID_PROPERTY} in the properties.
*/
default void sendEvent(String topic, Map<String, Object> properties) {
throw new UnsupportedOperationException();
}
+ default Object getData(String key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @SuppressWarnings("unchecked")
+ default <T> T getUiContext(Class<T> clss) {
+ return (T) getData(clss.getName());
+ }
+
+ default <T> void setUiContext(Class<T> clss, T instance) {
+ setData(clss.getName(), instance);
+ }
+
+ default void setData(String key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
static CmsView getCmsView(Control parent) {
// find parent shell
Shell topShell = parent.getShell();