Search in sources :

Example 21 with IArchimateConcept

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

the class ZestView method setElement.

private void setElement(Object object) {
    IArchimateConcept concept = null;
    if (object instanceof IArchimateConcept) {
        concept = (IArchimateConcept) object;
    } else if (object instanceof IAdaptable) {
        concept = ((IAdaptable) object).getAdapter(IArchimateConcept.class);
    }
    fDrillDownManager.setNewInput(concept);
    updateActions();
    updateLabel();
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IArchimateConcept(com.archimatetool.model.IArchimateConcept)

Example 22 with IArchimateConcept

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

the class ZestViewerContentProvider method getRelations.

/**
 * Get all relations from source and target of concept and add to list, no more than DEPTH
 */
private void getRelations(List<IArchimateRelationship> mainList, List<IArchimateConcept> checkList, IArchimateConcept concept, int count) {
    if (checkList.contains(concept)) {
        return;
    }
    checkList.add(concept);
    if (count > fDepth) {
        return;
    }
    count++;
    List<IArchimateRelationship> allRelationships = ArchimateModelUtils.getAllRelationshipsForConcept(concept);
    for (IArchimateRelationship relationship : allRelationships) {
        IArchimateConcept other = relationship.getSource().equals(concept) ? relationship.getTarget() : relationship.getSource();
        int direction = relationship.getSource().equals(concept) ? DIR_OUT : DIR_IN;
        if (!mainList.contains(relationship) && fViewpoint.isAllowedConcept(other.eClass()) && !isFilteredByRelationship(relationship)) {
            if (direction == fDirection || fDirection == DIR_BOTH) {
                mainList.add(relationship);
            }
        }
        if (fViewpoint.isAllowedConcept(other.eClass()) && !isFilteredByRelationship(relationship)) {
            if (direction == fDirection || fDirection == DIR_BOTH) {
                getRelations(mainList, checkList, other, count);
            }
        }
    }
}
Also used : IArchimateConcept(com.archimatetool.model.IArchimateConcept) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IViewpoint(com.archimatetool.model.viewpoints.IViewpoint)

Example 23 with IArchimateConcept

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

the class MyExporter method writeFolder.

private void writeFolder(IFolder folder) throws IOException {
    List<EObject> list = new ArrayList<EObject>();
    getElements(folder, list);
    for (EObject eObject : list) {
        if (eObject instanceof IArchimateConcept) {
            IArchimateConcept concept = (IArchimateConcept) eObject;
            String string = normalise(concept.eClass().getName()) + "," + // $NON-NLS-1$
            normalise(concept.getName()) + "," + // $NON-NLS-1$
            normalise(concept.getDocumentation());
            // $NON-NLS-1$
            writer.write(string + "\n");
        }
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) IArchimateConcept(com.archimatetool.model.IArchimateConcept)

Example 24 with IArchimateConcept

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

the class MyImporter method createAndAddArchimateComponent.

protected IArchimateConcept createAndAddArchimateComponent(IArchimateModel model, EClass type, String name, String id) {
    IArchimateConcept concept = (IArchimateConcept) IArchimateFactory.eINSTANCE.create(type);
    concept.setName(name);
    concept.setId(id);
    IFolder folder = model.getDefaultFolderForObject(concept);
    folder.getElements().add(concept);
    idLookup.put(concept.getId(), concept);
    return concept;
}
Also used : IArchimateConcept(com.archimatetool.model.IArchimateConcept) IFolder(com.archimatetool.model.IFolder)

Example 25 with IArchimateConcept

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

the class DrillDownManager method goBack.

void goBack() {
    if (!fBackStack.isEmpty()) {
        saveCurrentState();
        IArchimateConcept concept = (IArchimateConcept) fBackStack.pop();
        if (isDeletedObject(concept)) {
            reset();
            return;
        }
        fCurrentConcept = concept;
        setGraphViewerInput(concept);
        updateNavigationButtons();
        restoreLastState();
        fView.updateLabel();
    }
}
Also used : IArchimateConcept(com.archimatetool.model.IArchimateConcept)

Aggregations

IArchimateConcept (com.archimatetool.model.IArchimateConcept)38 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)14 ArrayList (java.util.ArrayList)9 IDiagramModel (com.archimatetool.model.IDiagramModel)7 EObject (org.eclipse.emf.ecore.EObject)7 IArchimateElement (com.archimatetool.model.IArchimateElement)6 IDiagramModelArchimateComponent (com.archimatetool.model.IDiagramModelArchimateComponent)6 Test (org.junit.Test)6 IDiagramModelComponent (com.archimatetool.model.IDiagramModelComponent)5 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IArchimateDiagramEditor (com.archimatetool.editor.diagram.IArchimateDiagramEditor)3 IDiagramModelEditor (com.archimatetool.editor.diagram.IDiagramModelEditor)3 IArchimateModel (com.archimatetool.model.IArchimateModel)3 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)3 CSVParseException (com.archimatetool.csv.CSVParseException)2 NonNotifyingCompoundCommand (com.archimatetool.editor.model.commands.NonNotifyingCompoundCommand)2 IConnectable (com.archimatetool.model.IConnectable)2 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)2 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)2