Search in sources :

Example 1 with ProjectOnSaveEvent

use of org.apache.cayenne.modeler.event.ProjectOnSaveEvent in project cayenne by apache.

the class SaveAsAction method performAction.

public void performAction() {
    ProjectValidator projectValidator = getApplication().getInjector().getInstance(ProjectValidator.class);
    ValidationResult validationResult = projectValidator.validate(getCurrentProject().getRootNode());
    getProjectController().fireProjectOnSaveEvent(new ProjectOnSaveEvent(SaveAsAction.class));
    try {
        if (!saveAll()) {
            return;
        }
    } catch (Exception ex) {
        throw new CayenneRuntimeException("Error on save", ex);
    }
    getApplication().getFrameController().projectSavedAction();
    // If there were errors or warnings at validation, display them
    if (validationResult.getFailures().size() > 0) {
        ValidatorDialog.showDialog(Application.getFrame(), validationResult.getFailures());
    }
}
Also used : CayenneRuntimeException(org.apache.cayenne.CayenneRuntimeException) ProjectValidator(org.apache.cayenne.project.validation.ProjectValidator) ProjectOnSaveEvent(org.apache.cayenne.modeler.event.ProjectOnSaveEvent) ValidationResult(org.apache.cayenne.validation.ValidationResult) CayenneRuntimeException(org.apache.cayenne.CayenneRuntimeException)

Aggregations

CayenneRuntimeException (org.apache.cayenne.CayenneRuntimeException)1 ProjectOnSaveEvent (org.apache.cayenne.modeler.event.ProjectOnSaveEvent)1 ProjectValidator (org.apache.cayenne.project.validation.ProjectValidator)1 ValidationResult (org.apache.cayenne.validation.ValidationResult)1