-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore ability to modify selection in GroupRequest within DeleteAction #617
Conversation
The lazy check with objects.get(0) I mentioned: gef-classic/org.eclipse.gef/src/org/eclipse/gef/ui/actions/DeleteAction.java Lines 93 to 115 in 4660b69
gef-classic/org.eclipse.gef/src/org/eclipse/gef/ui/actions/MatchSizeAction.java Lines 72 to 119 in 4660b69
|
The list returned by getSelectedEditParts() should be a view of the internal selection, similar to getSelectedObjects(). Meaning callers are able to modify by the selection by calling set(int,Object). In order to reduce the chance of an undesirable ClassCastException, we only check whether the first element in the list is an EditPart, assuming that all remaining elements are as well. I.e. we don't expect a "mixed" selection of different types. This is similar to what has already been done in e.g. the DeleteAction or the MatchSizeAction. This is a follow-up to 78c3fed. Resolves eclipse-gef#616
* | ||
* @return A List containing the currently selected objects. | ||
*/ | ||
protected List<Object> getSelectedObjects() { | ||
protected List<?> getSelectedObjects() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an API breaking change and break BIRT's build:
eclipse-birt/birt#1972 (comment)
Please revert it.
- The return type cannot be changed from List<Object> to List<?> without breaking client calling or override this protected method. eclipse-gef#617
- The return type cannot be changed from List<Object> to List<?> without breaking client calling or override this protected method. #617
The list returned by getSelectedEditParts() should be a view of the internal selection, similar to getSelectedObjects(). Meaning callers are able to modify by the selection by calling set(int,Object).
In order to reduce the chance of an undesirable ClassCastException, we only check whether the first element in the list is an EditPart, assuming that all remaining elements are as well. I.e. we don't expect a "mixed" selection of different types. This is similar to what has already been done in e.g. the DeleteAction or the MatchSizeAction.
This is a follow-up to 78c3fed.
Resolves #616