Class TemplateLangModelUtility

    • Constructor Detail

      • TemplateLangModelUtility

        private TemplateLangModelUtility()
        Prevents external creation.
    • Method Detail

      • createModel

        public TranslationResult<Template> createModel​(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit root,
                                                       java.net.URI uri,
                                                       boolean registerSuccessful)
        Create the build language model from an EMF implementation unit.
        Parameters:
        root - the root-level build unit
        uri - the URI of the project to resolve (in order to find the closest project, may be null)
        registerSuccessful - successfully created models shall be registered
        Returns:
        the created variability model including messages
      • parse

        public TranslationResult<Template> parse​(org.eclipse.emf.common.util.URI uri,
                                                 ImportResolver<Template> resolver)
                                          throws java.io.IOException
        Description copied from class: ModelUtility
        Parse an IVML model file for standalone application (without editor) with a given import resolver.
        Note: This method is called by de.uni_hildesheim.sse.model.management.VarModel so if you intend to use the management facilities in de.uni_hildesheim.sse.model.management.VarModel let the de.uni_hildesheim.sse.model.management.VarModel do this job for you and do not call this method directly!
        Specified by:
        parse in class ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,​Template>
        Parameters:
        uri - the location of the model, e.g. via URI.createURI("dummy:/example.ex1")
        resolver - the import resolver (may be null for a new default import resolver)
        Returns:
        the created variability model including messages
        Throws:
        java.io.IOException - in case of any I/O or URI problem
      • print

        public void print​(TranslationResult<Template> result,
                          java.io.Writer out,
                          boolean emitComments,
                          boolean emitImports)
        Prints the model stored in the result to the console output stream (for debugging / testing).
        Parameters:
        result - the result instance
        out - the output writer
        emitComments - whether comments shall be emitted
        emitImports - whether imports shall be emitted
      • getLanguageName

        protected java.lang.String getLanguageName()
        Description copied from class: ModelUtility
        Returns the language name as specified in the xText configuration. This name can be found as URL in the grammar file or corresponds to the Java path of the grammar-XMI file in src-gen.
        Specified by:
        getLanguageName in class ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,​Template>
        Returns:
        the language name in Java package notation
      • getLanguageClassLoader

        protected java.lang.ClassLoader getLanguageClassLoader()
        Description copied from class: ModelUtility
        Returns the actual class loader of the language. This loader may be different due to different bundles.
        Specified by:
        getLanguageClassLoader in class ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,​Template>
        Returns:
        the class loader
      • createExpression

        public Expression createExpression​(java.lang.String text,
                                           Resolver resolver,
                                           java.lang.StringBuilder warnings)
                                    throws VilException
        Parses text into an expression.
        Parameters:
        text - the text to be parsed
        environment - the runtime environment for resolving variables
        an - optional buffer to collect warnings
        Returns:
        the resulting expression
        Throws:
        VilException - in case that parsing fails
      • createExpression

        public Expression createExpression​(java.lang.String text,
                                           Resolver resolver,
                                           java.lang.StringBuilder warnings,
                                           IvmlMessageAdapter adapter)
                                    throws VilException
        Parses text into an expression.
        Parameters:
        text - the text to be parsed
        environment - the runtime environment for resolving variables
        an - optional buffer to collect warnings
        adapter - optional message adapter (may be null for default)
        Returns:
        the resulting expression
        Throws:
        VilException - in case that parsing fails
      • getExtension

        public java.lang.String getExtension()
        Description copied from class: ModelUtility
        Returns the file extension / identifier to react on.
        Specified by:
        getExtension in class ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,​Template>
        Returns:
        the extension
      • obtainInfo

        public java.util.List<ModelInfo<Template>> obtainInfo​(org.eclipse.emf.common.util.URI uri)
                                                       throws java.io.IOException
        Obtains model information.
        Specified by:
        obtainInfo in class ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,​Template>
        Parameters:
        uri - the URI to read the info from
        Returns:
        the project info instances related to uri
        Throws:
        java.io.IOException - in case that an I/O error happens during parsing