use of org.contextmapper.dsl.ui.handler.wizard.DeriveSubdomainsFromRequirementsWizard in project context-mapper-dsl by ContextMapper.
the class GenerateSubdomainFromUserRequirementsRefactoringHandler method executeRefactoring.
@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
Set<UserRequirement> userRequirements = getAllSelectedElements().stream().filter(o -> o instanceof UserRequirement).map(o -> (UserRequirement) o).collect(Collectors.toSet());
List<String> allDomains = getCurrentContextMappingModel().getDomains().stream().map(d -> d.getName()).collect(Collectors.toList());
String initialDomain = allDomains.isEmpty() ? "" : allDomains.iterator().next();
DeriveSubdomainsFromRequirementsContext refactoringContext = new DeriveSubdomainsFromRequirementsContext(initialDomain, collectAllDomainsAndSubdomains(getCurrentContextMappingModel()));
new WizardDialog(HandlerUtil.getActiveShell(event), new DeriveSubdomainsFromRequirementsWizard(refactoringContext, executionContext -> {
return finishRefactoring(new DeriveSubdomainFromUserRequirements(executionContext.getDomainName(), executionContext.getSubdomainName(), userRequirements.stream().map(ur -> ur.getName()).collect(Collectors.toSet())), resource, event);
})).open();
}
Aggregations