catch(DataAccessException e) {
logger.error("Exception while getting versions: " + e.getLocalizedMessage(), e);
// add error to Alerts
AlertService alertService = (AlertService)ServiceUtils.getService(bundleContext, AlertService.class.getName());
alertService.addAlert(new Alert(Alert.Type.ERROR, "campaign.editor", e.getLocalizedMessage()));
}
version.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
logger.debug("setting campaign edition; index = " + version.getSelectionIndex());
Version v = (Version)version.getData("version" + version.getSelectionIndex());
logger.trace("v: " + v);
if(v != null) {
campaign.setVersion(v);
logger.debug("setting editor as dirty");
dirty = true;
}
}
});
// setting (line 2, half-width)
logger.debug("creating setting chooser");
label = new Label(generalGroup, SWT.RIGHT);
label.setText(Messages.getString("campaign.editor.setting.label"));
label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
setting = new Combo(generalGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
setting.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
SettingDao settingDao = (SettingDao)ServiceUtils.getService(bundleContext, SettingDao.class.getName());
try {
int i = 0;
for(Setting s : settingDao.getSettings()) {
setting.add(s.getLabel());
setting.setData(s.getLabel(), s);
setting.setData("setting" + i, s);
if(campaign.getSetting() == s) {
setting.select(i);
}
i++;
}
}
catch(DataAccessException e) {
logger.error("Exception while getting settings: " + e.getLocalizedMessage(), e);
// add error to Alerts
AlertService alertService = (AlertService)ServiceUtils.getService(bundleContext, AlertService.class.getName());
alertService.addAlert(new Alert(Alert.Type.ERROR, "campaign.editor", e.getLocalizedMessage()));
}
setting.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}