Search in sources :

Example 1 with DeriveBoundedContextFromSubdomainsWizard

use of org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsWizard in project context-mapper-dsl by ContextMapper.

the class GenerateBoundedContextFromSubdomainRefactoringHandler method executeRefactoring.

@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
    Set<Subdomain> subdomains = getAllSelectedElements().stream().filter(sd -> sd instanceof Subdomain).map(sd -> (Subdomain) sd).collect(Collectors.toSet());
    Set<String> boundedContexts = resource.getContextMappingModel().getBoundedContexts().stream().map(bc -> bc.getName()).collect(Collectors.toSet());
    Set<String> ids = subdomains.stream().map(sd -> sd.getName()).collect(Collectors.toSet());
    DeriveBoundedContextFromSubdomainsContext refactoringContext = new DeriveBoundedContextFromSubdomainsContext("NewContextFromSubdomains", boundedContexts);
    new WizardDialog(HandlerUtil.getActiveShell(event), new DeriveBoundedContextFromSubdomainsWizard(refactoringContext, executionContext -> {
        return finishRefactoring(new DeriveBoundedContextFromSubdomains(executionContext.getBoundedContextName(), ids), resource, event);
    })).open();
}
Also used : ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) DeriveBoundedContextFromSubdomainsWizard(org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsWizard) DeriveBoundedContextFromSubdomainsContext(org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsContext) DeriveBoundedContextFromSubdomains(org.contextmapper.dsl.refactoring.DeriveBoundedContextFromSubdomains) WizardDialog(org.eclipse.jface.wizard.WizardDialog) Optional(java.util.Optional) Set(java.util.Set) EObject(org.eclipse.emf.ecore.EObject) Subdomain(org.contextmapper.dsl.contextMappingDSL.Subdomain) Collectors(java.util.stream.Collectors) CMLResource(org.contextmapper.dsl.cml.CMLResource) HandlerUtil(org.eclipse.ui.handlers.HandlerUtil) DeriveBoundedContextFromSubdomains(org.contextmapper.dsl.refactoring.DeriveBoundedContextFromSubdomains) DeriveBoundedContextFromSubdomainsWizard(org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsWizard) Subdomain(org.contextmapper.dsl.contextMappingDSL.Subdomain) DeriveBoundedContextFromSubdomainsContext(org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsContext) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

Optional (java.util.Optional)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 CMLResource (org.contextmapper.dsl.cml.CMLResource)1 Subdomain (org.contextmapper.dsl.contextMappingDSL.Subdomain)1 DeriveBoundedContextFromSubdomains (org.contextmapper.dsl.refactoring.DeriveBoundedContextFromSubdomains)1 DeriveBoundedContextFromSubdomainsContext (org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsContext)1 DeriveBoundedContextFromSubdomainsWizard (org.contextmapper.dsl.ui.handler.wizard.DeriveBoundedContextFromSubdomainsWizard)1 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)1 EObject (org.eclipse.emf.ecore.EObject)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 HandlerUtil (org.eclipse.ui.handlers.HandlerUtil)1