- // if(!(key instanceof SpecimenOrObservationType)) {
- //
- // //FIXME : This should probably go into some ValidatorFactory
- // IInputValidator nonEmptyInputValidator = null;
- // //FIXME : This is a workaround to not allow empty strings in the
- // // input dialog for User and Group entities.
- // // Normally this should be default
- // // behaviour, so we need to discuss whether this handler
- // // should be used to handle the creating new entities of
- // // type other than User and Group.
- // // Once #4348 is fixed this check can be removed.
- // if(text.equals(UserCreator.USER) || text.equals(GroupCreator.GROUP)) {
- // nonEmptyInputValidator = new IInputValidator() {
- // @Override
- // public String isValid(String text) {
- // if(text == null || text.isEmpty()) {
- // return "Input cannot be empty";
- // }
- // return null;
- // }
- // };
- // }
- // InputDialog dialog = new InputDialog(shell,
- // String.format("Create %s", text), String.format("Enter new %s", text), "",
- // nonEmptyInputValidator);
- //
- // if (dialog.open() != Window.CANCEL) {
- // ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue());
- // }
- // } else {
- // ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled");
- // }
- //
- // } else {
- // ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject();
- // }
+ if (dialog.open() != Window.CANCEL) {
+ IEntityCreator entityCreator = bulkEditor.getEditorInput().getEntityCreator();
+ Object createdEntity = entityCreator.createEntity(key, dialog.getValue());
+ bulkEditor.getEditorInput().getModel().add(createdEntity);
+ bulkEditor.refresh(true);
+ bulkEditor.setDirty();
+ }