Search in sources :

Example 61 with IArchimateModel

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

the class ModelCompatibility method isLaterModelVersion.

/**
 * Check a model version against another version number
 * @param presentVersion The version to check against
 */
public boolean isLaterModelVersion(String presentVersion) {
    IArchimateModel model = (IArchimateModel) fResource.getContents().get(0);
    String version = model.getVersion();
    return version != null && StringUtils.compareVersionNumbers(version, presentVersion) > 0;
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 62 with IArchimateModel

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

the class Archimate2To3Handler method fixCompatibility.

@Override
public void fixCompatibility(Resource resource) throws CompatibilityHandlerException {
    IArchimateModel model = (IArchimateModel) resource.getContents().get(0);
    if (!isArchimate2Model(model)) {
        return;
    }
    model.setDefaults();
    convertFolders(model);
    moveElements(model, model.getFolder(FolderType.BUSINESS));
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 63 with IArchimateModel

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

the class FixDefaultSizesHandler method fixCompatibility.

@Override
public void fixCompatibility(Resource resource) throws CompatibilityHandlerException {
    IArchimateModel model = (IArchimateModel) resource.getContents().get(0);
    // Check all widths and heights
    fixMissingWidthAndHeight(model);
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 64 with IArchimateModel

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

the class EditorModelManager method openModel.

@Override
public IArchimateModel openModel(File file) {
    if (file == null || !file.exists()) {
        return null;
    }
    // If it is already loaded return it
    IArchimateModel model = locateLoadedModel(file);
    if (model != null) {
        return model;
    }
    model = loadModel(file);
    if (model != null) {
        // Open Views of newly opened model if set in Preferences
        if (Preferences.doOpenDiagramsOnLoad()) {
            for (IDiagramModel dm : model.getDiagramModels()) {
                EditorManager.openDiagramEditor(dm);
            }
        }
        firePropertyChange(this, PROPERTY_MODEL_OPENED, null, model);
    }
    return model;
}
Also used : IDiagramModel(com.archimatetool.model.IDiagramModel) IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 65 with IArchimateModel

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

the class EditorModelManager method saveState.

// ========================== Persist backing file  ==========================
public void saveState() throws IOException {
    Document doc = new Document();
    // $NON-NLS-1$
    Element rootElement = new Element("models");
    doc.setRootElement(rootElement);
    for (IArchimateModel model : getModels()) {
        // has been saved
        File file = model.getFile();
        if (file != null) {
            // $NON-NLS-1$
            Element modelElement = new Element("model");
            // $NON-NLS-1$
            modelElement.setAttribute("file", file.getAbsolutePath());
            rootElement.addContent(modelElement);
        }
    }
    JDOMUtils.write2XMLFile(doc, backingFile);
}
Also used : Element(org.jdom2.Element) Document(org.jdom2.Document) IArchimateModel(com.archimatetool.model.IArchimateModel) File(java.io.File)

Aggregations

IArchimateModel (com.archimatetool.model.IArchimateModel)124 Test (org.junit.Test)51 File (java.io.File)35 IOException (java.io.IOException)22 IArchimateElement (com.archimatetool.model.IArchimateElement)14 EObject (org.eclipse.emf.ecore.EObject)14 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)13 ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)13 IDiagramModel (com.archimatetool.model.IDiagramModel)12 CommandStack (org.eclipse.gef.commands.CommandStack)11 IFolder (com.archimatetool.model.IFolder)10 ArrayList (java.util.ArrayList)10 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)9 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)9 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)7 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)6 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)6 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)5 IIdentifier (com.archimatetool.model.IIdentifier)5 GraficoModelLoader (org.archicontribs.modelrepository.grafico.GraficoModelLoader)5