use of uk.ac.diamond.daq.mapping.api.IMappingExperimentBeanProvider in project gda-core by openGDA.
the class MappingXanesTemplateHandler method loadTemplate.
private void loadTemplate(String templatePath) {
final IMappingExperimentBean template;
try {
final byte[] bytes = Files.readAllBytes(Paths.get(templatePath));
final String json = new String(bytes, "UTF-8");
final IMarshallerService marshaller = getService(IMarshallerService.class);
template = marshaller.unmarshal(json, MappingExperimentBean.class);
} catch (Exception e) {
logger.error("Error loading template", e);
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Mapping template", "Could not load map template. Map parameters have not been changed.");
return;
}
final IMappingExperimentBeanProvider beanProvider = getService(IMappingExperimentBeanProvider.class);
final IMappingExperimentBean currentBean = beanProvider.getMappingExperimentBean();
template.getScanDefinition().setMappingScanRegion(currentBean.getScanDefinition().getMappingScanRegion());
beanProvider.setMappingExperimentBean(template);
final MappingExperimentView view = (MappingExperimentView) getService(EPartService.class).findPart(MappingExperimentView.ID).getObject();
view.updateControls();
}
Aggregations