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;
}
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));
}
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);
}
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;
}
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);
}
Aggregations