Search in sources :

Example 6 with IFolder

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

the class Archimate2To3Handler method convertDerivedFolder.

private void convertDerivedFolder(IArchimateModel model, IFolder derivedFolder) {
    IFolder relationsFolder = model.getFolder(FolderType.RELATIONS);
    if (relationsFolder != null) {
        for (EObject eObject : new ArrayList<EObject>(derivedFolder.eContents())) {
            relationsFolder.getElements().add(eObject);
        }
    }
    model.getFolders().remove(derivedFolder);
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) IFolder(com.archimatetool.model.IFolder)

Example 7 with IFolder

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

the class ArchimateModel method createDefaultFolder.

private void createDefaultFolder(FolderType folderType, String folderName, int index) {
    if (getFolder(folderType) == null) {
        IFolder folder = IArchimateFactory.eINSTANCE.createFolder();
        folder.setType(folderType);
        folder.setName(folderName);
        getFolders().add(index, folder);
    }
}
Also used : IFolder(com.archimatetool.model.IFolder)

Example 8 with IFolder

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

the class DiagramModelArchimateConnection method removeArchimateConceptFromModel.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public void removeArchimateConceptFromModel() {
    IArchimateRelationship relationship = getArchimateRelationship();
    if (relationship != null) {
        IFolder folder = (IFolder) relationship.eContainer();
        if (folder != null) {
            folder.getElements().remove(relationship);
            relationship.disconnect();
        }
    }
}
Also used : IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IFolder(com.archimatetool.model.IFolder)

Example 9 with IFolder

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

the class CommandsTests method testDeleteArchimateElementCommand.

@Test
public void testDeleteArchimateElementCommand() {
    IArchimateElement element = (IArchimateElement) tm.getObjectByID("1544");
    assertNotNull(element);
    IFolder parent = (IFolder) element.eContainer();
    DeleteArchimateElementCommand cmd = new DeleteArchimateElementCommand(element);
    cmd.execute();
    assertNull(element.eContainer());
    assertFalse(parent.getElements().contains(element));
    cmd.undo();
    assertEquals(0, parent.getElements().indexOf(element));
}
Also used : IArchimateElement(com.archimatetool.model.IArchimateElement) IFolder(com.archimatetool.model.IFolder) Test(org.junit.Test)

Example 10 with IFolder

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

the class CommandsTests method testDeleteArchimateRelationshipCommand.

@Test
public void testDeleteArchimateRelationshipCommand() {
    IArchimateRelationship relationship = (IArchimateRelationship) tm.getObjectByID("670aa5ed");
    assertNotNull(relationship);
    assertTrue(relationship.getSource().getSourceRelationships().contains(relationship));
    assertTrue(relationship.getTarget().getTargetRelationships().contains(relationship));
    IFolder parent = (IFolder) relationship.eContainer();
    DeleteArchimateRelationshipCommand cmd = new DeleteArchimateRelationshipCommand(relationship);
    cmd.execute();
    assertNull(relationship.eContainer());
    assertFalse(parent.getElements().contains(relationship));
    assertFalse(relationship.getSource().getSourceRelationships().contains(relationship));
    assertFalse(relationship.getTarget().getTargetRelationships().contains(relationship));
    cmd.undo();
    assertEquals(11, parent.getElements().indexOf(relationship));
}
Also used : IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IFolder(com.archimatetool.model.IFolder) Test(org.junit.Test)

Aggregations

IFolder (com.archimatetool.model.IFolder)41 Test (org.junit.Test)19 EObject (org.eclipse.emf.ecore.EObject)13 IArchimateElement (com.archimatetool.model.IArchimateElement)11 IArchimateModel (com.archimatetool.model.IArchimateModel)11 ArrayList (java.util.ArrayList)6 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)5 IDiagramModel (com.archimatetool.model.IDiagramModel)5 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)4 Command (org.eclipse.gef.commands.Command)4 CommandStack (org.eclipse.gef.commands.CommandStack)4 File (java.io.File)3 ICanvasModel (com.archimatetool.canvas.model.ICanvasModel)2 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)2 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)2 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 DropTargetEvent (org.eclipse.swt.dnd.DropTargetEvent)2