Search in sources :

Example 1 with ViewExtensionDescriptionConverter

use of org.eclipse.sirius.components.compatibility.forms.ViewExtensionDescriptionConverter in project sirius-components by eclipse-sirius.

the class FormRendererTests method testEcoreModel.

@Test
public void testEcoreModel() {
    ViewExtensionDescription viewExtensionDescription = this.createSiriusProperties();
    AQLInterpreterFactory interpreterFactory = new AQLInterpreterFactory() {

        @Override
        public AQLInterpreter create(ViewExtensionDescription viewExtensionDescription) {
            return new AQLInterpreter(List.of(), List.of(EcorePackage.eINSTANCE));
        }
    };
    IObjectService objectService = new IObjectService.NoOp();
    IRepresentationMetadataSearchService representationMetadataSearchService = new IRepresentationMetadataSearchService.NoOp();
    IIdentifierProvider identifierProvider = new IIdentifierProvider.NoOp() {

        @Override
        public String getIdentifier(Object element) {
            return UUID.randomUUID().toString();
        }
    };
    IdentifiedElementLabelProvider identifiedElementLabelProvider = new IdentifiedElementLabelProvider();
    ISemanticCandidatesProviderFactory semanticCandidatesProviderFactory = SemanticCandidatesProvider::new;
    IModelOperationHandlerSwitchProvider modelOperationHandlerSwitchProvider = interpeter -> new ModelOperationHandlerSwitch(objectService, representationMetadataSearchService, identifierProvider, List.of(), interpeter);
    ViewExtensionDescriptionConverter converter = new ViewExtensionDescriptionConverter(objectService, interpreterFactory, identifierProvider, semanticCandidatesProviderFactory, modelOperationHandlerSwitchProvider, identifiedElementLabelProvider);
    FormDescription description = converter.convert(viewExtensionDescription);
    this.checkResult(description);
}
Also used : Form(org.eclipse.sirius.components.forms.Form) EcorePackage(org.eclipse.emf.ecore.EcorePackage) IObjectService(org.eclipse.sirius.components.core.api.IObjectService) Category(org.eclipse.sirius.properties.Category) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) FormRenderer(org.eclipse.sirius.components.forms.renderer.FormRenderer) AbstractWidget(org.eclipse.sirius.components.forms.AbstractWidget) ViewExtensionDescription(org.eclipse.sirius.properties.ViewExtensionDescription) FormDescription(org.eclipse.sirius.components.forms.description.FormDescription) FormComponent(org.eclipse.sirius.components.forms.components.FormComponent) TextfieldDescription(org.eclipse.sirius.components.forms.description.TextfieldDescription) ModelOperationHandlerSwitch(org.eclipse.sirius.components.emf.compatibility.modeloperations.ModelOperationHandlerSwitch) ISemanticCandidatesProviderFactory(org.eclipse.sirius.components.compatibility.api.ISemanticCandidatesProviderFactory) ForDescription(org.eclipse.sirius.components.forms.description.ForDescription) CheckboxDescription(org.eclipse.sirius.components.forms.description.CheckboxDescription) PropertiesFactory(org.eclipse.sirius.properties.PropertiesFactory) SemanticCandidatesProvider(org.eclipse.sirius.components.emf.compatibility.SemanticCandidatesProvider) ViewExtensionDescriptionConverter(org.eclipse.sirius.components.compatibility.forms.ViewExtensionDescriptionConverter) IModelOperationHandlerSwitchProvider(org.eclipse.sirius.components.compatibility.api.IModelOperationHandlerSwitchProvider) SelectDescription(org.eclipse.sirius.components.forms.description.SelectDescription) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) AQLInterpreter(org.eclipse.sirius.components.interpreter.AQLInterpreter) Element(org.eclipse.sirius.components.representations.Element) IRepresentationMetadataSearchService(org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService) Test(org.junit.jupiter.api.Test) List(java.util.List) Group(org.eclipse.sirius.components.forms.Group) FormComponentProps(org.eclipse.sirius.components.forms.components.FormComponentProps) Optional(java.util.Optional) RadioDescription(org.eclipse.sirius.components.forms.description.RadioDescription) VariableManager(org.eclipse.sirius.components.representations.VariableManager) IdentifiedElementLabelProvider(org.eclipse.sirius.components.compatibility.services.representations.IdentifiedElementLabelProvider) AQLInterpreterFactory(org.eclipse.sirius.components.emf.compatibility.AQLInterpreterFactory) IIdentifierProvider(org.eclipse.sirius.components.compatibility.api.IIdentifierProvider) AQLInterpreter(org.eclipse.sirius.components.interpreter.AQLInterpreter) IIdentifierProvider(org.eclipse.sirius.components.compatibility.api.IIdentifierProvider) ViewExtensionDescriptionConverter(org.eclipse.sirius.components.compatibility.forms.ViewExtensionDescriptionConverter) ModelOperationHandlerSwitch(org.eclipse.sirius.components.emf.compatibility.modeloperations.ModelOperationHandlerSwitch) ISemanticCandidatesProviderFactory(org.eclipse.sirius.components.compatibility.api.ISemanticCandidatesProviderFactory) ViewExtensionDescription(org.eclipse.sirius.properties.ViewExtensionDescription) AQLInterpreterFactory(org.eclipse.sirius.components.emf.compatibility.AQLInterpreterFactory) IdentifiedElementLabelProvider(org.eclipse.sirius.components.compatibility.services.representations.IdentifiedElementLabelProvider) IModelOperationHandlerSwitchProvider(org.eclipse.sirius.components.compatibility.api.IModelOperationHandlerSwitchProvider) IRepresentationMetadataSearchService(org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService) IObjectService(org.eclipse.sirius.components.core.api.IObjectService) FormDescription(org.eclipse.sirius.components.forms.description.FormDescription) Test(org.junit.jupiter.api.Test)

Aggregations

List (java.util.List)1 Optional (java.util.Optional)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 EcorePackage (org.eclipse.emf.ecore.EcorePackage)1 IIdentifierProvider (org.eclipse.sirius.components.compatibility.api.IIdentifierProvider)1 IModelOperationHandlerSwitchProvider (org.eclipse.sirius.components.compatibility.api.IModelOperationHandlerSwitchProvider)1 ISemanticCandidatesProviderFactory (org.eclipse.sirius.components.compatibility.api.ISemanticCandidatesProviderFactory)1 ViewExtensionDescriptionConverter (org.eclipse.sirius.components.compatibility.forms.ViewExtensionDescriptionConverter)1 IdentifiedElementLabelProvider (org.eclipse.sirius.components.compatibility.services.representations.IdentifiedElementLabelProvider)1 IObjectService (org.eclipse.sirius.components.core.api.IObjectService)1 IRepresentationMetadataSearchService (org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService)1 AQLInterpreterFactory (org.eclipse.sirius.components.emf.compatibility.AQLInterpreterFactory)1 SemanticCandidatesProvider (org.eclipse.sirius.components.emf.compatibility.SemanticCandidatesProvider)1 ModelOperationHandlerSwitch (org.eclipse.sirius.components.emf.compatibility.modeloperations.ModelOperationHandlerSwitch)1 AbstractWidget (org.eclipse.sirius.components.forms.AbstractWidget)1 Form (org.eclipse.sirius.components.forms.Form)1 Group (org.eclipse.sirius.components.forms.Group)1 FormComponent (org.eclipse.sirius.components.forms.components.FormComponent)1