Search in sources :

Example 1 with ArchimateElementEditPart

use of com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart in project archi by archimatetool.

the class PropertiesLabelProviderTests method testGetTextElement.

@Test
public void testGetTextElement() {
    // Text for element
    IArchimateElement element = IArchimateFactory.eINSTANCE.createArtifact();
    String text = provider.getText(new StructuredSelection(element));
    assertEquals("Artifact", text);
    // Text for DiagramModelArchimateObject
    IDiagramModelArchimateObject dmo = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
    dmo.setArchimateElement(element);
    text = provider.getText(new StructuredSelection(dmo));
    assertEquals("Artifact", text);
    // Text for EditPart
    EditPart editPart = new ArchimateElementEditPart();
    editPart.setModel(dmo);
    text = provider.getText(new StructuredSelection(editPart));
    assertEquals("Artifact", text);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) NoteEditPart(com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart) EditPart(org.eclipse.gef.EditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) IArchimateElement(com.archimatetool.model.IArchimateElement) IDiagramModelArchimateObject(com.archimatetool.model.IDiagramModelArchimateObject) Test(org.junit.Test)

Example 2 with ArchimateElementEditPart

use of com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart in project archi by archimatetool.

the class PropertiesLabelProviderTests method testGetImageElement.

@Test
public void testGetImageElement() {
    IArchimateElement element = IArchimateFactory.eINSTANCE.createArtifact();
    // Image for element
    Image image1 = provider.getImage(new StructuredSelection(element));
    assertNotNull(image1);
    // Image for DiagramModelArchimateObject
    IDiagramModelArchimateObject dmo = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
    dmo.setArchimateElement(element);
    Image image2 = provider.getImage(new StructuredSelection(dmo));
    assertSame(image1, image2);
    // Image for EditPart
    EditPart editPart = new ArchimateElementEditPart();
    editPart.setModel(dmo);
    Image image3 = provider.getImage(new StructuredSelection(editPart));
    assertSame(image1, image3);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArchimateRelationshipEditPart(com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) NoteEditPart(com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart) EditPart(org.eclipse.gef.EditPart) ArchimateElementEditPart(com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart) IArchimateElement(com.archimatetool.model.IArchimateElement) IDiagramModelArchimateObject(com.archimatetool.model.IDiagramModelArchimateObject) Image(org.eclipse.swt.graphics.Image) Test(org.junit.Test)

Aggregations

ArchimateElementEditPart (com.archimatetool.editor.diagram.editparts.ArchimateElementEditPart)2 ArchimateRelationshipEditPart (com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart)2 NoteEditPart (com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart)2 IArchimateElement (com.archimatetool.model.IArchimateElement)2 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)2 EditPart (org.eclipse.gef.EditPart)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 Test (org.junit.Test)2 Image (org.eclipse.swt.graphics.Image)1