Hi folks,
I was writing a some more event handler code today and thought that
UIEvents could use some simple utility methods. I'd like to add them if
nobody has any objections.
It is typical for an event handler to want to know the type of the event.
ADD, REMOVE, SET etc. Currently code that cares writes
if (UIEvents.EventTypes.ADD.equals(event.getProperty(UIEvents.EventTypes.
ADD)) {
// foo
} else if ((UIEvents.EventTypes.SET
.equals(UIEvents.event.getProperty(EventTypes.SET) {
// bar
}
or I suppose this would be good enough too
if (event.containsProperty(UIEvents.EventTypes.ADD)) {
// foo
} else if ((event.containsProperty(UIEvents.EventTypes.SET)) {
// bar
}
If we define utility methods on UIEvents like
public static boolean isAdd(Event event);
public static boolean isSet(Event event);
Then the above code could look like
if (UIEvents.isAdd(event)) {
// foo
} else if (UIEvents.isSet(event) {
// bar
}
Admitedly the containsProperty() implementation may be good enough ... I
only thought of that one while writing this email.
Does anybody have strong feelings one way or the other? I think I still
like the utility method implementation.
[email protected]
_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev