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);
}
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);
}
Aggregations