Skip to content

Commit

Permalink
eclipse-glsp#101 Ensure proper handling of empty DeleteElementOperati…
Browse files Browse the repository at this point in the history
…on (eclipse-glsp#72)

Log a warning instead of throwing an exception if no elementIds are specified for an DeleteElementAction.
Throwing an exception here will break the command stack. In addition, it's not necessary because technically an empty DeleteElementOperation is still valid (and simply does not affect the model at all)

Fixes eclipse-glsp/glsp/issues/101
  • Loading branch information
tortmayr authored Aug 20, 2020
1 parent 240aa82 commit 4a8be94
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class DeleteOperationHandler extends BasicOperationHandler<DeleteOperatio
public void executeOperation(final DeleteOperation operation, final GraphicalModelState modelState) {
List<String> elementIds = operation.getElementIds();
if (elementIds == null || elementIds.size() == 0) {
throw new IllegalArgumentException("Elements to delete are not specified");
log.warn("Elements to delete are not specified");
return;
}
GModelIndex index = modelState.getIndex();
allDependantsIds = new HashSet<>();
Expand Down

0 comments on commit 4a8be94

Please sign in to comment.