Search in sources :

Example 51 with IArchimateElement

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

the class ZestViewerContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof IArchimateConcept) {
        IArchimateConcept archimateConcept = (IArchimateConcept) inputElement;
        // Check if it was deleted
        if (archimateConcept.eContainer() == null) {
            return new Object[0];
        }
        // Relationship
        if (archimateConcept instanceof IArchimateRelationship) {
            return new Object[] { inputElement };
        }
        // Element - Get its relationships
        if (archimateConcept instanceof IArchimateElement) {
            List<IArchimateRelationship> mainList = new ArrayList<IArchimateRelationship>();
            getRelations(mainList, new ArrayList<IArchimateConcept>(), archimateConcept, 0);
            return mainList.toArray();
        }
    }
    return new Object[0];
}
Also used : ArrayList(java.util.ArrayList) IArchimateConcept(com.archimatetool.model.IArchimateConcept) IArchimateElement(com.archimatetool.model.IArchimateElement) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship)

Example 52 with IArchimateElement

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

the class ArchimateDiagramEditPartFactoryTests method testArchimateObjectEditPart.

@Test
public void testArchimateObjectEditPart() {
    IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
    IDiagramModelArchimateObject dmo = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
    dmo.setArchimateElement(element);
    EditPart editPart = editPartFactory.createEditPart(null, dmo);
    assertTrue(editPart instanceof ArchimateElementEditPart);
    assertEquals(dmo, editPart.getModel());
}
Also used : GroupEditPart(com.archimatetool.editor.diagram.editparts.diagram.GroupEditPart) NoteEditPart(com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart) EditPart(org.eclipse.gef.EditPart) EmptyEditPart(com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart) IArchimateElement(com.archimatetool.model.IArchimateElement) IDiagramModelArchimateObject(com.archimatetool.model.IDiagramModelArchimateObject) Test(org.junit.Test)

Example 53 with IArchimateElement

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

the class CSVExporterTests method testCreateElementRow_WithLeadingCharsHack.

@Test
public void testCreateElementRow_WithLeadingCharsHack() {
    IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
    element.setId("087dfa23");
    element.setName("  The Main Man");
    element.setDocumentation("0123");
    exporter.setUseLeadingCharsHack(true);
    assertEquals("\"=\"\"087dfa23\"\"\",\"BusinessActor\",\"=\"\"  The Main Man\"\"\",\"=\"\"0123\"\"\"", exporter.createElementRow(element));
}
Also used : IArchimateElement(com.archimatetool.model.IArchimateElement) Test(org.junit.Test)

Example 54 with IArchimateElement

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

the class CSVExporterTests method testCreateElementRow_WithNewLinesStripped.

@Test
public void testCreateElementRow_WithNewLinesStripped() {
    IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
    element.setId("d452fda");
    element.setName("The Main Man");
    element.setDocumentation("This is the\r\nDocumentation");
    exporter.setStripNewLines(true);
    assertEquals("\"d452fda\",\"BusinessActor\",\"The Main Man\",\"This is the Documentation\"", exporter.createElementRow(element));
}
Also used : IArchimateElement(com.archimatetool.model.IArchimateElement) Test(org.junit.Test)

Example 55 with IArchimateElement

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

the class CSVExporterTests method testCreatePropertyRow_Property.

@Test
public void testCreatePropertyRow_Property() {
    IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
    element.setId("1234567a");
    IProperty property = IArchimateFactory.eINSTANCE.createProperty();
    property.setKey("Some key");
    property.setValue("Some value");
    element.getProperties().add(property);
    assertEquals("\"1234567a\",\"Some key\",\"Some value\"", exporter.createPropertyRow(element.getId(), property));
}
Also used : IProperty(com.archimatetool.model.IProperty) IArchimateElement(com.archimatetool.model.IArchimateElement) Test(org.junit.Test)

Aggregations

IArchimateElement (com.archimatetool.model.IArchimateElement)92 Test (org.junit.Test)57 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)33 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)30 ArrayList (java.util.ArrayList)19 IDiagramModel (com.archimatetool.model.IDiagramModel)16 IArchimateModel (com.archimatetool.model.IArchimateModel)14 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)13 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)11 IFolder (com.archimatetool.model.IFolder)11 EObject (org.eclipse.emf.ecore.EObject)11 IIssue (com.archimatetool.hammer.validation.issues.IIssue)8 ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)8 IArchimateConcept (com.archimatetool.model.IArchimateConcept)6 Command (org.eclipse.gef.commands.Command)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 WarningType (com.archimatetool.hammer.validation.issues.WarningType)4 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)4 CommandStack (org.eclipse.gef.commands.CommandStack)4 NoteEditPart (com.archimatetool.editor.diagram.editparts.diagram.NoteEditPart)3