Class BslTemplate

  • All Implemented Interfaces:
    ITemplate

    public class BslTemplate
    extends Object
    implements ITemplate
    This class is basic implementation of ITemplate with setters and parameterized with BslTemplateContext that supports contexts of module environment and module contexts
    • Constructor Detail

      • BslTemplate

        public BslTemplate​(String name,
                           String description,
                           BslTemplateContext context,
                           String pattern,
                           boolean isAutoinsertable)
        Creates new instance of template with given preferences
        Parameters:
        name - The name of template, is a trigger-word as well. Has to be unique and does not contain any whitespaces, cannot be null
        description - The description of template, the user-readable representation of template, used in context assist, cannot be null
        context - The context of template, that is used to compute whether this template can be applied in the given position of the model, cannot be null
        pattern - The pattern is the code that is inserted, when the template is called. Also may contain some special keywords that are processed in some way during the template application, cannot be null
        isAutoinsertable - True means that this template will not call template assistant, when the written text matches the template name. False means that this template is called only as usual templates through content assist
      • BslTemplate

        public BslTemplate​(BslTemplate other)
        Creates copy of given template
        Parameters:
        other - The template to copy, cannot be null
      • BslTemplate

        public BslTemplate()
        Creates empty instance of template by calling another constructor with some default values
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: ITemplate
        Returns the name of the template. This is its id and its trigger-word
        Specified by:
        getName in interface ITemplate
        Returns:
        The name of template, cannot be null
      • getDescription

        public String getDescription()
        Description copied from interface: ITemplate
        Returns the description of the template
        Specified by:
        getDescription in interface ITemplate
        Returns:
        The description of template, cannot be null
      • getTemplateContext

        public BslTemplateContext getTemplateContext()
        Description copied from interface: ITemplate
        The template context that is used to check where template is applicable
        Specified by:
        getTemplateContext in interface ITemplate
        Returns:
        The context where this template is applicable, cannot be null
      • getPattern

        public String getPattern()
        Description copied from interface: ITemplate
        Returns the pattern string for this template, which will be inserted after all variables are processed
        Specified by:
        getPattern in interface ITemplate
        Returns:
        The pattern string, cannot be null
      • isAutoinsertable

        public boolean isAutoinsertable()
        Description copied from interface: ITemplate
        Whether this template can be inserted without calling content assist if previous text matches the name
        Specified by:
        isAutoinsertable in interface ITemplate
        Returns:
        Whether this template can be autoinserted
      • setName

        public void setName​(String name)
        Description copied from interface: ITemplate
        Sets the name of the template to the given one
        Specified by:
        setName in interface ITemplate
        Parameters:
        name - The name to set, cannot be null
      • setDescription

        public void setDescription​(String description)
        Description copied from interface: ITemplate
        Sets the description of the template to the given one
        Specified by:
        setDescription in interface ITemplate
        Parameters:
        description - The description to set, cannot be null
      • setTemplateContext

        public void setTemplateContext​(ITemplateContext context)
        Description copied from interface: ITemplate
        Sets the template context to given context
        Specified by:
        setTemplateContext in interface ITemplate
        Parameters:
        context - The context to set, cannot be null
      • setPattern

        public void setPattern​(String pattern)
        Description copied from interface: ITemplate
        Sets the pattern of the template to the given one
        Specified by:
        setPattern in interface ITemplate
        Parameters:
        pattern - The pattern to set, cannot be null