use of org.contextmapper.dsl.contextMappingDSL.Volatility in project context-mapper-dsl by ContextMapper.
the class LikelihoodForChangeSelectionWizardPage method createControl.
@Override
public void createControl(Composite parent) {
container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 2;
// name label
Label boundedContextNameLabel1 = new Label(container, SWT.NONE);
boundedContextNameLabel1.setText("Volatility (Likelihood for Change):");
// selection field
selectionCombo = new Combo(container, SWT.DROP_DOWN);
selectionCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
List<String> selectionStrings = Arrays.asList(Volatility.values()).stream().map(l -> l.getName()).collect(Collectors.toList());
selectionCombo.setItems(selectionStrings.toArray(new String[selectionStrings.size()]));
selectionCombo.select(selectionStrings.indexOf(Volatility.OFTEN.getName()));
selectionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setPageComplete(isPageComplete());
updateValidationMessage();
}
});
selectionCombo.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
setPageComplete(isPageComplete());
updateValidationMessage();
}
});
setControl(container);
setPageComplete(false);
}
use of org.contextmapper.dsl.contextMappingDSL.Volatility in project context-mapper-dsl by ContextMapper.
the class ExtractAggregatesByVolatilityRefactoringHandler method isEnabled.
@Override
public boolean isEnabled() {
EObject obj = getSelectedElement();
if (obj == null || !super.isEnabled())
return false;
// only allowed on bounded contexts
if (!(obj instanceof BoundedContext))
return false;
BoundedContext bc = (BoundedContext) obj;
List<Volatility> likelihoods = bc.getAggregates().stream().map(agg -> agg.getLikelihoodForChange()).collect(Collectors.toList());
return likelihoods.size() > 1;
}
Aggregations