/*package*/ void updateModelVersion( RefactorableSModelDescriptor model, final Map<String, Object> _params) { int modelVersion = model.getVersion(); int historyVersion = model.getStructureModificationLog().getLatestVersion(model.getSModelReference()); if (modelVersion < historyVersion) { LOG.info( "updating version of " + model + " from " + modelVersion + " to .history version " + historyVersion); model.setVersion(historyVersion); model.setChanged(true); } else if (modelVersion > historyVersion && historyVersion != -1) { LOG.info( "history version of " + model + " is smaller than model version: " + historyVersion + "<" + modelVersion); } }
/*package*/ void updateImportVersions( EditableSModelDescriptor model, final Map<String, Object> _params) { jetbrains.mps.smodel.SModel m = model.getSModel(); for (jetbrains.mps.smodel.SModel.ImportElement importElement : ListSequence.fromList(SModelOperations.getAllImportElements(model.getSModel()))) { RefactorableSModelDescriptor usedModel = as_hexye9_a0a0a1a7( SModelRepository.getInstance().getModelDescriptor(importElement.getModelReference()), RefactorableSModelDescriptor.class); if (usedModel == null) { continue; } if (importElement.getUsedVersion() < usedModel.getVersion()) { LOG.info( model + ": updating used version of " + importElement.getModelReference() + " from " + importElement.getUsedVersion() + " to " + usedModel.getVersion()); m.updateImportedModelUsedVersion(importElement.getModelReference(), usedModel.getVersion()); model.setChanged(true); } else if (importElement.getUsedVersion() > usedModel.getVersion()) { LOG.error( model + ": used version of " + importElement.getModelReference() + " is greater than model version: " + importElement.getUsedVersion() + ">" + usedModel.getVersion()); m.updateImportedModelUsedVersion(importElement.getModelReference(), usedModel.getVersion()); model.setChanged(true); } } }