Search in sources :

Example 6 with ISketchModel

use of com.archimatetool.model.ISketchModel in project archi by archimatetool.

the class SketchEditPartFactoryTests method testSketchDiagramPart.

@Test
public void testSketchDiagramPart() {
    ISketchModel sm = IArchimateFactory.eINSTANCE.createSketchModel();
    EditPart editPart = editPartFactory.createEditPart(null, sm);
    assertTrue(editPart instanceof SketchDiagramPart);
    assertEquals(sm, editPart.getModel());
}
Also used : DiagramConnectionEditPart(com.archimatetool.editor.diagram.editparts.DiagramConnectionEditPart) EditPart(org.eclipse.gef.EditPart) EmptyEditPart(com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart) ISketchModel(com.archimatetool.model.ISketchModel) Test(org.junit.Test)

Example 7 with ISketchModel

use of com.archimatetool.model.ISketchModel in project archi by archimatetool.

the class DiagramUtilsTests method testCreateViewer_SketchModel.

@Test
public void testCreateViewer_SketchModel() {
    IDiagramModel dm = model.getDiagramModels().get(1);
    assertTrue(dm instanceof ISketchModel);
    Shell shell = new Shell();
    GraphicalViewerImpl viewer = DiagramUtils.createViewer(dm, shell);
    assertNotNull(viewer);
    assertTrue(viewer.getEditPartFactory() instanceof SketchEditPartFactory);
    assertTrue(viewer.getRootEditPart() instanceof FreeformGraphicalRootEditPart);
    assertSame(dm, viewer.getContents().getModel());
    assertSame(shell, viewer.getControl().getShell());
    shell.dispose();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IDiagramModel(com.archimatetool.model.IDiagramModel) GraphicalViewerImpl(org.eclipse.gef.ui.parts.GraphicalViewerImpl) SketchEditPartFactory(com.archimatetool.editor.diagram.sketch.editparts.SketchEditPartFactory) FreeformGraphicalRootEditPart(org.eclipse.gef.editparts.FreeformGraphicalRootEditPart) ISketchModel(com.archimatetool.model.ISketchModel) Test(org.junit.Test)

Example 8 with ISketchModel

use of com.archimatetool.model.ISketchModel in project archi by archimatetool.

the class ArchiLabelProviderTests method testGetGraphicsIconForDiagramModel.

@Test
public void testGetGraphicsIconForDiagramModel() {
    // Null object
    assertNull(ArchiLabelProvider.INSTANCE.getGraphicsIconForDiagramModel(null));
    // Models
    IArchimateDiagramModel dm = IArchimateFactory.eINSTANCE.createArchimateDiagramModel();
    assertNotNull(ArchiLabelProvider.INSTANCE.getGraphicsIconForDiagramModel(dm));
    ISketchModel sm = IArchimateFactory.eINSTANCE.createSketchModel();
    assertNotNull(ArchiLabelProvider.INSTANCE.getGraphicsIconForDiagramModel(sm));
}
Also used : ISketchModel(com.archimatetool.model.ISketchModel) IArchimateDiagramModel(com.archimatetool.model.IArchimateDiagramModel) Test(org.junit.Test)

Aggregations

ISketchModel (com.archimatetool.model.ISketchModel)8 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)4 Test (org.junit.Test)4 IDiagramEditorFactory (com.archimatetool.editor.diagram.IDiagramEditorFactory)2 SketchEditPartFactory (com.archimatetool.editor.diagram.sketch.editparts.SketchEditPartFactory)2 FreeformGraphicalRootEditPart (org.eclipse.gef.editparts.FreeformGraphicalRootEditPart)2 GraphicalViewerImpl (org.eclipse.gef.ui.parts.GraphicalViewerImpl)2 DiagramEditorInput (com.archimatetool.editor.diagram.DiagramEditorInput)1 IDiagramModelEditor (com.archimatetool.editor.diagram.IDiagramModelEditor)1 ArchimateDiagramEditPartFactory (com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory)1 DiagramConnectionEditPart (com.archimatetool.editor.diagram.editparts.DiagramConnectionEditPart)1 EmptyEditPart (com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart)1 NewDiagramCommand (com.archimatetool.editor.views.tree.commands.NewDiagramCommand)1 NewElementCommand (com.archimatetool.editor.views.tree.commands.NewElementCommand)1 IDiagramModel (com.archimatetool.model.IDiagramModel)1 IDiagramModelImage (com.archimatetool.model.IDiagramModelImage)1 INameable (com.archimatetool.model.INameable)1 EditPart (org.eclipse.gef.EditPart)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 RootEditPart (org.eclipse.gef.RootEditPart)1