Interface ModelRoot


  • public interface ModelRoot
    Represents a logically connected group of models that come from a related physical origin, such as a file or a directory. For implementation consider extending jetbrains.mps.extapi.persistence.ModelRootBase, jetbrains.mps.extapi.persistence.FolderModelRootBase or jetbrains.mps.extapi.persistence.FileBasedModelRoot. The model root MPS workflow is as follows: 1. ModelRoot is constructed; 2. The method load(Memento) is called to fill the ModelRoot with data. Note that any model root must be attached to a module during construction
    See Also:
    getModule()
    • Method Detail

      • getType

        String getType()
        A customizable categorization identifier, such as JavaStubs
      • getPresentation

        String getPresentation()
        A textual representation of the model root
      • getModule

        SModule getModule()
        The owning module which must be present as well. The module must be fixed for a model root and passed via constructor (TODO) obviously the returned module is the one which has this model root among its SModule.getModelRoots()
      • getModels

        @NotNull
        Iterable<SModel> getModels()
        Returns:
        a sequence of the models under this model root. Implementors must impose some order on the returned result, such that two consequent invocations of this method return equal results. Note that owning module also returns all the models (module is believed to be a model container) SModule.getModels(), however it might contain the models which are not attached to the model roots as well (!)
      • canCreateModels

        @Deprecated
        boolean canCreateModels()
        Deprecated.
        use specific #canCreateModel(SModelName)
        There are model roots which are read-only and fix the result of getModels() right away from the construction FIXME it is strange to have two similar methods: we are better to merge this method into the method canCreateModel(java.lang.String).
        Returns:
        whether this model root is read-only in the way described above
      • canCreateModel

        @Deprecated
        boolean canCreateModel​(@NotNull
                               String modelName)
        Deprecated.
        use the one with SModelName as parameter
        Parameters:
        modelName - -- the same as in the createModel(String)
        Returns:
        whether a model with a name modelName can be created under this model root.
      • save

        void save​(@NotNull
                  Memento memento)
        Gives the model root the opportunity to persist into the supplied memento whatever configuration information may be needed to restore the models in the future.
      • load

        void load​(@NotNull
                  Memento memento)
        Allows the model root to read its previously saved configuration information