Search in sources :

Example 1 with View

use of org.eclipse.sirius.components.view.View in project sirius-web by eclipse-sirius.

the class StereotypeDescriptionRegistryConfigurer method getEmptyViewContent.

private String getEmptyViewContent() {
    View newView = ViewFactory.eINSTANCE.createView();
    DiagramDescription diagramDescription = ViewFactory.eINSTANCE.createDiagramDescription();
    // $NON-NLS-1$
    diagramDescription.setName("New Diagram Description");
    newView.getDescriptions().add(diagramDescription);
    return this.stereotypeBuilder.getStereotypeBody(newView);
}
Also used : View(org.eclipse.sirius.components.view.View) DiagramDescription(org.eclipse.sirius.components.view.DiagramDescription)

Example 2 with View

use of org.eclipse.sirius.components.view.View in project sirius-components by eclipse-sirius.

the class DynamicDiagramsTests method render.

private Diagram render(DiagramDescription diagramDescription, Object target) {
    // Wrap into a View, as expected by ViewConverter
    View view = ViewFactory.eINSTANCE.createView();
    view.getDescriptions().add(diagramDescription);
    var viewConverter = new ViewConverter(new IObjectService.NoOp(), new IEditService.NoOp(), List.of());
    List<IRepresentationDescription> conversionResult = viewConverter.convert(view, List.of(EcorePackage.eINSTANCE));
    assertThat(conversionResult).hasSize(1);
    assertThat(conversionResult.get(0)).isInstanceOf(org.eclipse.sirius.components.diagrams.description.DiagramDescription.class);
    org.eclipse.sirius.components.diagrams.description.DiagramDescription convertedDiagramDescription = (org.eclipse.sirius.components.diagrams.description.DiagramDescription) conversionResult.get(0);
    IRepresentationDescriptionSearchService representationDescriptionSearchService = new IRepresentationDescriptionSearchService.NoOp() {

        @Override
        public Optional<IRepresentationDescription> findById(IEditingContext editingContext, UUID representationDescriptionId) {
            return Optional.of(convertedDiagramDescription);
        }
    };
    IObjectService objectService = new IObjectService.NoOp();
    ILayoutService layoutService = new ILayoutService.NoOp();
    MeterRegistry meterRegistry = new SimpleMeterRegistry();
    var diagramCreationService = new DiagramCreationService(representationDescriptionSearchService, new IRepresentationPersistenceService.NoOp(), objectService, layoutService, meterRegistry);
    IEditingContext editinContext = new IEditingContext.NoOp();
    // $NON-NLS-1$
    return diagramCreationService.create("Test Diagram", target, convertedDiagramDescription, editinContext);
}
Also used : IRepresentationDescriptionSearchService(org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService) IRepresentationDescription(org.eclipse.sirius.components.representations.IRepresentationDescription) DiagramCreationService(org.eclipse.sirius.components.collaborative.diagrams.DiagramCreationService) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) IEditService(org.eclipse.sirius.components.core.api.IEditService) ILayoutService(org.eclipse.sirius.components.diagrams.layout.api.ILayoutService) UUID(java.util.UUID) IRepresentationPersistenceService(org.eclipse.sirius.components.collaborative.api.IRepresentationPersistenceService) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) View(org.eclipse.sirius.components.view.View) DiagramDescription(org.eclipse.sirius.components.view.DiagramDescription) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) IObjectService(org.eclipse.sirius.components.core.api.IObjectService)

Aggregations

DiagramDescription (org.eclipse.sirius.components.view.DiagramDescription)2 View (org.eclipse.sirius.components.view.View)2 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 UUID (java.util.UUID)1 IRepresentationPersistenceService (org.eclipse.sirius.components.collaborative.api.IRepresentationPersistenceService)1 DiagramCreationService (org.eclipse.sirius.components.collaborative.diagrams.DiagramCreationService)1 IEditService (org.eclipse.sirius.components.core.api.IEditService)1 IEditingContext (org.eclipse.sirius.components.core.api.IEditingContext)1 IObjectService (org.eclipse.sirius.components.core.api.IObjectService)1 IRepresentationDescriptionSearchService (org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService)1 ILayoutService (org.eclipse.sirius.components.diagrams.layout.api.ILayoutService)1 IRepresentationDescription (org.eclipse.sirius.components.representations.IRepresentationDescription)1