Package jetbrains.mps.util
Class ReferenceUpdater
- java.lang.Object
 - 
- jetbrains.mps.util.ReferenceUpdater
 
 
- 
public final class ReferenceUpdater extends Object
Utility class that provides model/module reference updating in a group of models/modules. Expected workflow: You collect models & modules where you want update references byaddModelToAdjust(SModel, SModel)andaddModuleToAdjust(SModule, SModule). Than you invokeadjust()to replace all old references with new references in collected models & modules. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReferenceUpdater.RefUpdateException 
- 
Field Summary
Fields Modifier and Type Field Description static Comparator<SModel>MODEL_BY_NAME_COMPARATOR 
- 
Constructor Summary
Constructors Constructor Description ReferenceUpdater() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddModelToAdjust(SModel oldModel, SModel newModel)AddnewModelto adjust if it is editable.voidaddModuleToAdjust(SModule oldModule, SModule newModule)AddnewModuleto adjust.voidadjust()For each collected module: 1) update all module dependencies according tomyModuleReferenceMapFor each collected model: 1) update all model references in model imports according tomyModelReferenceMap2) update all languages imports according tomyUsedLanguagesMap3) update all model references in it's nodes according tomyModelReferenceMapIt saves all models after references updating.List<SModel>getModels()List<SModule>getModules() 
 - 
 
- 
- 
Field Detail
- 
MODEL_BY_NAME_COMPARATOR
public static final Comparator<SModel> MODEL_BY_NAME_COMPARATOR
 
 - 
 
- 
Method Detail
- 
addModuleToAdjust
public void addModuleToAdjust(@NotNull SModule oldModule, @NotNull SModule newModule) throws ReferenceUpdater.RefUpdateException
AddnewModuleto adjust. After adjusting, other modules & models will refer tonewModuleinstead ofoldModuleUpdates inner models by default- Parameters:
 oldModule- old module - others contain refs to itnewModule- new module - others will contain refs to it- Throws:
 ReferenceUpdater.RefUpdateException
 
- 
addModelToAdjust
public void addModelToAdjust(@NotNull SModel oldModel, @NotNull SModel newModel) throws ReferenceUpdater.RefUpdateException
AddnewModelto adjust if it is editable. After adjusting, other models will refer tonewModelinstead ofoldModel- Parameters:
 oldModel- old model - other models contain refs to itnewModel- new model - other models will be contain refs to it- Throws:
 ReferenceUpdater.RefUpdateException
 
- 
adjust
public void adjust() throws ReferenceUpdater.RefUpdateExceptionFor each collected module: 1) update all module dependencies according tomyModuleReferenceMapFor each collected model: 1) update all model references in model imports according tomyModelReferenceMap2) update all languages imports according tomyUsedLanguagesMap3) update all model references in it's nodes according tomyModelReferenceMapIt saves all models after references updating. Note that after calling this method you can't use this instance to update references. 
 - 
 
 -