XulFileDialog fc = (XulFileDialog) document.createElement(ELEM_ID_FILEDIALOG);
fc.setModalParent(((XulDialog)document.getElementById(ELEM_ID_EXPORT_DIALOG)).getRootObject());
MondrianFileSchemaModel schemaModel = (MondrianFileSchemaModel) connectionModel.getSelectedSchemaModel();
RETURN_CODE retVal = fc.showSaveDialog(new File(schemaModel.getMondrianSchemaFilename()));
File selectedFile = null;
if (retVal == RETURN_CODE.OK) {
selectedFile = (File) fc.getFile();
if (logger.isDebugEnabled()) {
logger.debug("Selected Save file: " + selectedFile.getAbsolutePath());
}
StringBuilder data = new StringBuilder();
List<UIAggregate> aggList = getEnabledAggs();
List<Output> outputs = new ArrayList<Output>();
for (UIAggregate agg : aggList) {
outputs.add(agg.getOutput());
}
try {
data.append(outputService.getFullArtifact(outputs, SchemaGenerator.class));
} catch (OutputValidationException e1) {
if (logger.isErrorEnabled()) {
logger.error("an exception occurred", e1);
}
return null;
}
try {
FileUtils.writeStringToFile(selectedFile, data.toString());
schemaModel.setMondrianSchemaFilename(selectedFile.getCanonicalPath());
connectionModel.setSchemaUpToDate(true);
return selectedFile;
} catch (IOException e) {
if (logger.isErrorEnabled()) {
logger.error("an exception occurred", e);