use of org.eclipse.sirius.diagram.description.tool.Navigation in project sirius-components by eclipse-sirius.
the class NavigationOperationHandlerTests method testMultipleChildModelOperationWithSelection.
@Test
public void testMultipleChildModelOperationWithSelection() {
DiagramDescription firstDiagramDescription = DescriptionFactory.eINSTANCE.createDiagramDescription();
firstDiagramDescription.setLabel(FIRST_DIAGRAM_DESCRIPTION_ID.toString());
Navigation firstNavigation = ToolFactory.eINSTANCE.createNavigation();
firstNavigation.setCreateIfNotExistent(false);
firstNavigation.setDiagramDescription(firstDiagramDescription);
DiagramDescription secondDiagramDescription = DescriptionFactory.eINSTANCE.createDiagramDescription();
secondDiagramDescription.setLabel(SECOND_DIAGRAM_DESCRIPTION_ID.toString());
Navigation secondNavigation = ToolFactory.eINSTANCE.createNavigation();
secondNavigation.setCreateIfNotExistent(false);
secondNavigation.setDiagramDescription(secondDiagramDescription);
IStatus status = new ChildModelOperationHandler(List.of()).handle(new IObjectService.NoOp(), this.representationMetadataSearchService, this.diagramDescriptionIdentifierProvider, new AQLInterpreter(List.of(), List.of()), Map.of(IEditingContext.EDITING_CONTEXT, new IEditingContext.NoOp()), List.of(firstNavigation, secondNavigation));
assertThat(status).isInstanceOf(Success.class);
Success success = (Success) status;
Object selectionParameter = success.getParameters().get(Success.NEW_SELECTION);
assertThat(selectionParameter).isInstanceOf(WorkbenchSelection.class);
WorkbenchSelection selection = (WorkbenchSelection) selectionParameter;
// @formatter:off
assertThat(selection).isEqualTo(new WorkbenchSelection(List.of(new WorkbenchSelectionEntry(FIRST_DIAGRAM_ID, FIRST_DIAGRAM_LABEL, Diagram.KIND), new WorkbenchSelectionEntry(SECOND_DIAGRAM_ID, SECOND_DIAGRAM_LABEL, Diagram.KIND), new WorkbenchSelectionEntry(THIRD_DIAGRAM_ID, THIRD_DIAGRAM_LABEL, Diagram.KIND))));
// @formatter:on
}
use of org.eclipse.sirius.diagram.description.tool.Navigation in project sirius-components by eclipse-sirius.
the class NavigationOperationHandlerTests method testChildModelOperationWithSelection.
@Test
public void testChildModelOperationWithSelection() {
DiagramDescription diagramDescription = DescriptionFactory.eINSTANCE.createDiagramDescription();
diagramDescription.setLabel(FIRST_DIAGRAM_DESCRIPTION_ID.toString());
Navigation navigation = ToolFactory.eINSTANCE.createNavigation();
navigation.setCreateIfNotExistent(false);
navigation.setDiagramDescription(diagramDescription);
IStatus status = new ChildModelOperationHandler(List.of()).handle(new IObjectService.NoOp(), this.representationMetadataSearchService, this.diagramDescriptionIdentifierProvider, new AQLInterpreter(List.of(), List.of()), Map.of(IEditingContext.EDITING_CONTEXT, new IEditingContext.NoOp()), List.of(navigation));
assertThat(status).isInstanceOf(Success.class);
Success success = (Success) status;
Object selectionParameter = success.getParameters().get(Success.NEW_SELECTION);
assertThat(selectionParameter).isInstanceOf(WorkbenchSelection.class);
WorkbenchSelection selection = (WorkbenchSelection) selectionParameter;
// @formatter:off
assertThat(selection).isEqualTo(new WorkbenchSelection(List.of(new WorkbenchSelectionEntry(FIRST_DIAGRAM_ID, FIRST_DIAGRAM_LABEL, Diagram.KIND), new WorkbenchSelectionEntry(SECOND_DIAGRAM_ID, SECOND_DIAGRAM_LABEL, Diagram.KIND))));
// @formatter:on
}
Aggregations