Search in sources :

Example 21 with IProfile

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

the class ArchimateConceptTests method testGetPrimaryProfile.

@Test
public void testGetPrimaryProfile() {
    assertNull(concept.getPrimaryProfile());
    IProfile profile1 = IArchimateFactory.eINSTANCE.createProfile();
    IProfile profile2 = IArchimateFactory.eINSTANCE.createProfile();
    concept.getProfiles().add(profile1);
    concept.getProfiles().add(profile2);
    assertSame(profile1, concept.getPrimaryProfile());
}
Also used : IProfile(com.archimatetool.model.IProfile) Test(org.junit.Test)

Example 22 with IProfile

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

the class ModelChecker method checkProfiles.

List<String> checkProfiles(IProfiles profilesObject) {
    List<String> messages = new ArrayList<String>();
    for (IProfile profile : profilesObject.getProfiles()) {
        // $NON-NLS-1$
        String name = " " + profile.getId();
        // Profile must exist in this model
        if (profile.getArchimateModel() != ((IArchimateModelObject) profilesObject).getArchimateModel()) {
            messages.add(Messages.ModelChecker_28 + name);
        }
        // Profile must have matching concept type
        EClass eClass = profile.getConceptClass();
        if (eClass == null || eClass != profilesObject.eClass()) {
            messages.add(Messages.ModelChecker_29 + name);
        }
    }
    return messages;
}
Also used : EClass(org.eclipse.emf.ecore.EClass) ArrayList(java.util.ArrayList) IProfile(com.archimatetool.model.IProfile)

Example 23 with IProfile

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

the class Profile method getCopy.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public EObject getCopy() {
    IProfile newObject = EcoreUtil.copy(this);
    // need a new ID
    newObject.setId(UUIDFactory.createID(newObject));
    return newObject;
}
Also used : IProfile(com.archimatetool.model.IProfile)

Example 24 with IProfile

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

the class CSVExporterTests method testCreateRelationshipRow.

@Test
public void testCreateRelationshipRow() {
    IArchimateElement elementSource = IArchimateFactory.eINSTANCE.createBusinessActor();
    elementSource.setId("cfde5463e");
    IArchimateElement elementTarget = IArchimateFactory.eINSTANCE.createBusinessActor();
    elementTarget.setId("b1234dff");
    IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAccessRelationship();
    relation.setId("56435fd6");
    relation.setName("My relation");
    relation.setDocumentation("This is the Documentation");
    relation.setSource(elementSource);
    relation.setTarget(elementTarget);
    IProfile profile = IArchimateFactory.eINSTANCE.createProfile();
    profile.setName("Profile");
    relation.getProfiles().add(profile);
    assertEquals("\"56435fd6\",\"AccessRelationship\",\"My relation\",\"This is the Documentation\",\"cfde5463e\",\"b1234dff\",\"Profile\"", exporter.createRelationshipRow(relation));
}
Also used : IArchimateElement(com.archimatetool.model.IArchimateElement) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IProfile(com.archimatetool.model.IProfile) Test(org.junit.Test)

Example 25 with IProfile

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

the class SpecializationSection method update.

@Override
protected void update() {
    IArchimateModelObject firstSelected = getFirstSelectedObject();
    // Check also if the selected object has been deleted in case the Properties View is still showing the object if it has the focus
    if (fIsExecutingCommand || !isAlive(getFirstSelectedObject())) {
        return;
    }
    fComboViewer.refresh();
    if (firstSelected instanceof IArchimateConcept) {
        // A Viewer will get a selectionChanged event when setting it
        fIsRefreshing = true;
        EList<IProfile> profiles = ((IArchimateConcept) firstSelected).getProfiles();
        if (!profiles.isEmpty()) {
            fComboViewer.setSelection(new StructuredSelection(profiles.get(0)));
        } else {
            fComboViewer.setSelection(new StructuredSelection(NONE_PROFILE));
        }
        fIsRefreshing = false;
    }
}
Also used : IArchimateModelObject(com.archimatetool.model.IArchimateModelObject) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IArchimateConcept(com.archimatetool.model.IArchimateConcept) IProfile(com.archimatetool.model.IProfile)

Aggregations

IProfile (com.archimatetool.model.IProfile)34 Test (org.junit.Test)11 IArchimateModel (com.archimatetool.model.IArchimateModel)7 IArchimateConcept (com.archimatetool.model.IArchimateConcept)6 IArchimateElement (com.archimatetool.model.IArchimateElement)6 IDiagramModel (com.archimatetool.model.IDiagramModel)4 EObject (org.eclipse.emf.ecore.EObject)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)3 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)3 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)3 IProfiles (com.archimatetool.model.IProfiles)3 List (java.util.List)3 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)2 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)2 IFolder (com.archimatetool.model.IFolder)2 ArrayList (java.util.ArrayList)2 CommandStack (org.eclipse.gef.commands.CommandStack)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)2