/**
  * Shows invalid values for {@link CriterionSatisfaction} entities
  * @param e
  */
 private boolean validate() throws ValidationException {
     try {
         assignedTaskQualityFormsToOrderElementModel.validate();
     } catch (ValidationException e) {
         showInvalidValues(e);
         return false;
     } catch (IllegalStateException e) {
         messages.showMessage(Level.ERROR, e.getMessage());
         return false;
     } catch (IllegalArgumentException e) {
         messages.showMessage(Level.ERROR, e.getMessage());
         return false;
     }
     return true;
 }
 private void showInformativeMessage(String message) {
     try {
         Messagebox.show(_(message), _("Delete"), Messagebox.OK,
                 Messagebox.ERROR);
     } catch (InterruptedException e) {
         messagesForUser.showMessage(Level.ERROR, _(e.getMessage()));
     }
 }
    /**
     * Method called when the onUpload event happens.
     *
     * @param Media
     *            Media to be imported.
     */
    public void importProject(Media media) {

        String file = media.getName();

        if (checkFileFormat(file)) {

            if (importCalendars.isChecked()) {

                try {
                    importCalendar(media.getStreamData(), file);
                    messages.showMessage(Level.INFO, _(file
                            + ": Calendar import successfully!"));
                } catch (InstanceNotFoundException e) {
                    messages.showMessage(Level.ERROR, _("Instance not found."));
                } catch (ValidationException e) {
                    messages.showMessage(Level.ERROR, e.getMessage());
                }

            } else if (importTasks.isChecked()) {
                importProject(media.getStreamData(), file);

                messages.showMessage(Level.INFO, _(file
                        + ": Task import successfully!"));

            } else if (importAll.isChecked()) {

                try {
                    importAll(media.getStreamData(), file);
                    messages.showMessage(Level.INFO, _(file
                            + ": Import successfully!"));
                } catch (InstanceNotFoundException e) {
                    messages.showMessage(Level.ERROR, _("Instance not found."));
                } catch (ValidationException e) {
                    messages.showMessage(Level.ERROR, e.getMessage());
                }

            } else {
                messages.showMessage(Level.WARNING,
                        _("Select one of the options."));
            }

        } else {
            messages.showMessage(Level.ERROR,
                    _("The only current supported formats are mpp and planner."));
        }

    }