Class VilBuildLangProposalProviderUtility


  • public class VilBuildLangProposalProviderUtility
    extends java.lang.Object
    A utility class for determining different elements in the VIL build model based on the more generic information provided by the Xtext UI functionalities (typically EObject, etc.) Please note if multiple VIL scripts are defined in the same file, the proposals of the content assist may be wrong!
    Author:
    kroeher
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static VilBuildLangProposalProviderUtility INSTANCE
      The current instance of the utility class.
      private static java.lang.String[] OPERATIONS_BLACKLIST
      List of logical and arithmetic operations that is used to remove such operations from the operations list before returning it to the proposal provider.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit getActiveVilScript​(org.eclipse.xtext.nodemodel.INode node)
      Returns the active VIL-script.
      java.util.List<org.eclipse.jface.viewers.StyledString> getAllInstantiators​(org.eclipse.xtext.nodemodel.INode node)
      Returns all instantiators currently available in EASy-Producer.
      private java.util.List<de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl> getAllRules​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
      Returns a list of all RuleDeclarationImpl objects defined in the current VIL-script.
      java.util.List<org.eclipse.jface.viewers.StyledString> getAllRules​(org.eclipse.xtext.nodemodel.INode node, boolean deleteSelf)
      Returns all rules in the current script in terms of a StyledString including name and parameter list.
      java.util.List<java.lang.String> getAllTypes​(org.eclipse.xtext.nodemodel.INode node)
      Returns all VIL-types currently available in EASy-Producer.
      private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.VariableDeclarationImpl> getAllVariables​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
      Returns a list of all VariableDeclarationImpl objects defined in the current VIL-script.
      java.util.List<org.eclipse.jface.viewers.StyledString> getAllVarsForType​(org.eclipse.xtext.nodemodel.INode node, java.util.List<java.lang.String> typeList, boolean completeDefsOnly)
      Returns a List with all variables in the document, which have a specified type.
      private java.util.List<OperationDescriptor> getAvailableInstantiators​(org.eclipse.xtext.nodemodel.INode node)
      Returns a list with all available instantiators.
      private java.util.List<OperationDescriptor> getAvailableOperations​(org.eclipse.xtext.nodemodel.INode node)
      Get all VIL operations currently registered to EASy-Producer.
      de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.CallImpl getCallImpl​(org.eclipse.xtext.nodemodel.INode node)
      Tries to filter the CallImpl from a node.
      de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.ExpressionOrQualifiedExecutionImpl getExprOrExecution​(org.eclipse.xtext.nodemodel.INode node)  
      java.lang.String getIvmlModelName​(org.eclipse.emf.ecore.EObject rootObject)
      Returns the name of the first IVML-file which can be found in the parent-directory of the current VIL-file.
      private java.lang.String getMatchingType​(org.eclipse.xtext.nodemodel.INode node, java.lang.String id)
      Returns the closest matching type of an VIL element based on the identifier (the name) of the element and the corresponding node of this element in the syntax tree.
      java.util.List<org.eclipse.jface.viewers.StyledString> getOperationsMatchingReturnType​(org.eclipse.xtext.nodemodel.INode node)
      Returns all operations currently available in EASy-Producer that return a specific VIL-type.
      java.util.List<org.eclipse.jface.viewers.StyledString> getParentParameters​(org.eclipse.xtext.nodemodel.INode node)
      Returns all parameters defined in/for the parents of the semantic element of the passed node (recursion from inner to outer VIL-elements).
      private de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl getParentRule​(org.eclipse.xtext.nodemodel.INode node)
      Returns the RuleDeclarationImpl, so the object of the rule.
      java.util.List<org.eclipse.jface.viewers.StyledString> getParentVariables​(org.eclipse.xtext.nodemodel.INode node, boolean completeDefsOnly)
      Returns all variables defined in/for the parents of the semantic element of the passed node (recursion from inner to outer VIL-elements).
      private java.lang.String getReturnType​(java.lang.String id, org.eclipse.xtext.nodemodel.INode node)
      Returns the returntype of an specified operation.
      private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleElementBlockVars​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElementBlock)
      Returns all variables from the RuleElementBlock.
      private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleParameters​(org.eclipse.xtext.nodemodel.INode node)
      Returns all parameters defined for a specific rule.
      private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Parameter> getRuleParams​(org.eclipse.xtext.nodemodel.INode node)
      Returns the parameters from a rule.
      private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleVariables​(org.eclipse.xtext.nodemodel.INode node, boolean completeDefsOnly, boolean addLRHS)
      Returns all variables defined for a specific rule.
      private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleVars​(org.eclipse.xtext.nodemodel.INode node)
      Returns the variables from a rule.
      java.util.List<org.eclipse.jface.viewers.StyledString> getScriptParameters​(org.eclipse.xtext.nodemodel.INode node)
      Returns all parameters defined for a specific script.
      java.lang.String getScriptParametersForMainRule​(org.eclipse.xtext.nodemodel.INode node)  
      java.util.List<org.eclipse.jface.viewers.StyledString> getScriptVariables​(org.eclipse.xtext.nodemodel.INode node, boolean completeDefsOnly)
      Returns all variables defined for a specific script.
      private java.lang.String getSubCallPrefix​(org.eclipse.xtext.nodemodel.INode node)
      Returns the prefix of a sub-call (the identifier at the left-hand side of the "." for which the call is defined).
      private java.lang.String getType​(de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression logExpr, java.lang.String name)
      Get the name of the type of an VIL element based on the name (identifier) of this element.
      private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl ruleDecl, java.lang.String name)
      Get the name of the type of an VIL element based on the name (identifier) of this element.
      private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit script, java.lang.String name)
      Get the name of the type of an VIL element based on the name (identifier) of this element.
      private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock, java.lang.String name)
      Get the name of the type of an VIL element based on the name (identifier) of this element.
      private java.lang.String getType​(org.eclipse.xtext.nodemodel.INode node)
      Returns the type of an variable.
      private java.util.List<OperationDescriptor> getValidTypeOperationList​(org.eclipse.xtext.nodemodel.INode node)
      Returns a list of all valid operations for a specific VIL-type.
      private java.util.List<OperationDescriptor> getValidTypeOperations​(java.lang.String typeName, org.eclipse.xtext.nodemodel.INode node)
      Get all valid VIL operation for a specific VIL (artefact) type.
      java.util.List<org.eclipse.jface.viewers.StyledString> getValidTypeOperations​(org.eclipse.xtext.nodemodel.INode node, boolean returnAll)
      Returns all operations currently available in EASy-Producer or a subset of these operations that are valid for a specific VIL-type.
      private java.io.File getVilFile​(org.eclipse.emf.ecore.EObject rootObject)
      Returns the file of the VIL-Script.
      java.lang.String getVilFileName​(org.eclipse.emf.ecore.EObject rootObject)
      Returns the name of the current VIL file.
      private boolean hasElements​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)
      Checks if the RuleElementBlock has at least one element or not.
      private boolean hasElements​(java.util.List<?> list)
      Checks if a List has Elements or not.
      boolean hasScript​(org.eclipse.xtext.nodemodel.INode node)
      Checks whether a script is defined as part of the current VIL-file.
      boolean hasVersion​(org.eclipse.xtext.nodemodel.INode node)
      Checks whether the current VIL-build script has a version.
      boolean isMainRuleDeclared​(org.eclipse.xtext.nodemodel.INode node)  
      private java.util.List<org.eclipse.jface.viewers.StyledString> opsToDisplayString​(java.util.List<OperationDescriptor> operationsList)
      converts the operationnames into a content assist friendly format, which can be directly used to display.
      private void removeLogicalAndMathOperations​(java.util.List<OperationDescriptor> operationList)
      Removes unneeded operations from the operationList.
      java.util.List<java.lang.String> searchForRuleParameterTypes​(java.lang.String toSearch, org.eclipse.xtext.nodemodel.INode node)
      Returns a List with the types of the parameters from the rule, which is searched.
      private java.util.List<org.eclipse.jface.viewers.StyledString> varsToDisplayString​(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> varDeclList)
      converts the variablenames into a content assist friendly format, which can be directly used to display.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OPERATIONS_BLACKLIST

        private static final java.lang.String[] OPERATIONS_BLACKLIST
        List of logical and arithmetic operations that is used to remove such operations from the operations list before returning it to the proposal provider. This is only necessary if an operations list for defining variable values is requested. E.g. "x = ..." does not allow such operations after the "=".
    • Constructor Detail

      • VilBuildLangProposalProviderUtility

        private VilBuildLangProposalProviderUtility()
        Prevents external creation.
    • Method Detail

      • getScriptParameters

        public java.util.List<org.eclipse.jface.viewers.StyledString> getScriptParameters​(org.eclipse.xtext.nodemodel.INode node)
        Returns all parameters defined for a specific script. Typically this returns the following elements: Project source, Project target, and Configuration conf. However, the user may define additional parameters or may delete these script parameters (yielding a return values of null).
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. This node is used to determine the parent script and, thus, its parameters.
        Returns:
        a list of StyledString that includes all script parameters ready for displaying in the content assist or null if no script parameters are defined.
      • getAllRules

        public java.util.List<org.eclipse.jface.viewers.StyledString> getAllRules​(org.eclipse.xtext.nodemodel.INode node,
                                                                                  boolean deleteSelf)
        Returns all rules in the current script in terms of a StyledString including name and parameter list.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. This node is used to determine the parent script and, thus, all defined rules in this script.
        deleteSelf - if the passed node (last complete node) is a rules itself, we assume, that the content assist is called to complete a pre-/postcondition. In such a case, the rule for which the condition shall be completed must not be in the proposal list (deleteSelf = true). To return all rules of the script, use false.
        Returns:
        a list of StyledString that includes all rules ready for displaying in the content assist or null if no rule parameters are defined.
      • getScriptVariables

        public java.util.List<org.eclipse.jface.viewers.StyledString> getScriptVariables​(org.eclipse.xtext.nodemodel.INode node,
                                                                                         boolean completeDefsOnly)
        Returns all variables defined for a specific script. This includes also the implicit variables OTHERPROJECTS and SCRIPTDIR. However, variables that are defined as part of a rule or other elements than the script itself will not be considered.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. This node is used to determine the parent script and, thus, its variables.
        completeDefsOnly - in order to prevent proposals of incomplete variables, i.e. if the user calls the content assist for completing a variable definition, the incomplete variable(s) must not be proposed (completeDefsOnly = true). To return all variables of the script, use false.
        Returns:
        a list of StyledString that includes all script variables ready for displaying in the content assist or null if no script variables are defined.
      • getVilFileName

        public java.lang.String getVilFileName​(org.eclipse.emf.ecore.EObject rootObject)
        Returns the name of the current VIL file.
        Parameters:
        rootObject - the root element of the current context. Typically this is the ImplementationUnit.
        Returns:
        the name of the current VIL file or an empty string if the file could not be resolved.
      • getIvmlModelName

        public java.lang.String getIvmlModelName​(org.eclipse.emf.ecore.EObject rootObject)
        Returns the name of the first IVML-file which can be found in the parent-directory of the current VIL-file.
        Parameters:
        rootObject - the root element of the current context. Typically this is the ImplementationUnit.
        Returns:
        the name of the first IVML-file which can be found in the parent-directory of the current VIL-file or an empty string if no IVML-file is located in the parent-directory
      • getAllTypes

        public java.util.List<java.lang.String> getAllTypes​(org.eclipse.xtext.nodemodel.INode node)
        Returns all VIL-types currently available in EASy-Producer.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called.
        Returns:
        a list of the names (String) of all types currently registered to EASy-Producer.
      • hasVersion

        public boolean hasVersion​(org.eclipse.xtext.nodemodel.INode node)
        Checks whether the current VIL-build script has a version.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called.
        Returns:
        true if the current VIL-build script has a version. False otherwise.
      • hasScript

        public boolean hasScript​(org.eclipse.xtext.nodemodel.INode node)
        Checks whether a script is defined as part of the current VIL-file.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called.
        Returns:
        true if the current VIL-file includes a script-definition. False otherwise.
      • getValidTypeOperations

        public java.util.List<org.eclipse.jface.viewers.StyledString> getValidTypeOperations​(org.eclipse.xtext.nodemodel.INode node,
                                                                                             boolean returnAll)
        Returns all operations currently available in EASy-Producer or a subset of these operations that are valid for a specific VIL-type.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. The semantic element of this node may be used for determining the VIL-type for which the valid operations shall be returned.
        returnAll - true if all available operations should be return (regardless of the type of the node). False if only the valid operations for the type of the node should be returned.
        Returns:
        a list of StyledString that includes all operations (or all operations valid for a specific type) variables ready for displaying in the content assist or null if no operations are available.
      • getOperationsMatchingReturnType

        public java.util.List<org.eclipse.jface.viewers.StyledString> getOperationsMatchingReturnType​(org.eclipse.xtext.nodemodel.INode node)
        Returns all operations currently available in EASy-Producer that return a specific VIL-type.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. The semantic element of this node is used for determining the VIL-type the return type of the operations shall match.
        Returns:
        a list of StyledString that includes all operations which return the same type as the semantic element of the node ready for displaying in the content assist or null if no such operations are available.
      • getAllInstantiators

        public java.util.List<org.eclipse.jface.viewers.StyledString> getAllInstantiators​(org.eclipse.xtext.nodemodel.INode node)
        Returns all instantiators currently available in EASy-Producer.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called.
        Returns:
        a list of StyledString that includes all instantiators currently available in EASy-Producer ready for displaying in the content assist or null if no instantiators are available.
      • getParentParameters

        public java.util.List<org.eclipse.jface.viewers.StyledString> getParentParameters​(org.eclipse.xtext.nodemodel.INode node)
        Returns all parameters defined in/for the parents of the semantic element of the passed node (recursion from inner to outer VIL-elements). However, this will only return parameters of Map elements or surrounding Rule elements. Parameters or other elements from, e.g., a script must be determined using getScriptParameters.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. The semantic element of this node is used as the starting point for determining the parent-parameters recursively.
        Returns:
        a list of StyledString that includes all parameters of all surrounding VIL-elements (Map and Rule) ready for displaying in the content assist or null if no parameters are available.
      • getParentVariables

        public java.util.List<org.eclipse.jface.viewers.StyledString> getParentVariables​(org.eclipse.xtext.nodemodel.INode node,
                                                                                         boolean completeDefsOnly)
        Returns all variables defined in/for the parents of the semantic element of the passed node (recursion from inner to outer VIL-elements). However, this will only return variables of Map elements or surrounding Rule elements. Variables or other elements from, e.g., a script must be determined using getScriptVariables.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. The semantic element of this node is used as the starting point for determining the parent-variables recursively.
        completeDefsOnly - in order to prevent proposals of incomplete variables, i.e. if the user calls the content assist for completing a variable definition, the incomplete variable(s) must not be proposed (completeDefsOnly = true). To return all variables, use false
        Returns:
        a list of StyledString that includes all variables of all surrounding VIL-elements (Map and Rule) ready for displaying in the content assist or null if no variables are available.
      • searchForRuleParameterTypes

        public java.util.List<java.lang.String> searchForRuleParameterTypes​(java.lang.String toSearch,
                                                                            org.eclipse.xtext.nodemodel.INode node)
        Returns a List with the types of the parameters from the rule, which is searched.
        Parameters:
        toSearch - the name of the rule, for which we want the types of the parameters.
        node - the last complete node which will committed when we start using the content assist in braces.
        Returns:
        List with the parameter types. Can be null.
      • getCallImpl

        public de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.CallImpl getCallImpl​(org.eclipse.xtext.nodemodel.INode node)
        Tries to filter the CallImpl from a node. This method should only be used in a parameter-complete method.
        Parameters:
        node - the last complete node.
        Returns:
        the CallImpl from the node. Maybe null, if no CallImpl was found.
      • getExprOrExecution

        public de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.ExpressionOrQualifiedExecutionImpl getExprOrExecution​(org.eclipse.xtext.nodemodel.INode node)
      • getAllVarsForType

        public java.util.List<org.eclipse.jface.viewers.StyledString> getAllVarsForType​(org.eclipse.xtext.nodemodel.INode node,
                                                                                        java.util.List<java.lang.String> typeList,
                                                                                        boolean completeDefsOnly)
        Returns a List with all variables in the document, which have a specified type.
        Parameters:
        node - the last complete node, when the content assist is used.
        typeList - the List with all types.
        completeDefsOnly - true if you only want full declared variables, false if you don't.
        Returns:
        a List with all proposals, which are ready to display in the content assist. Maybe null if no variables found.
      • isMainRuleDeclared

        public boolean isMainRuleDeclared​(org.eclipse.xtext.nodemodel.INode node)
      • getScriptParametersForMainRule

        public java.lang.String getScriptParametersForMainRule​(org.eclipse.xtext.nodemodel.INode node)
      • getActiveVilScript

        private de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit getActiveVilScript​(org.eclipse.xtext.nodemodel.INode node)
        Returns the active VIL-script.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called.
        Returns:
        the active VIL-script in terms of a LanguageUnit object or null if no such object can be found.
      • getAllRules

        private java.util.List<de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl> getAllRules​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
        Returns a list of all RuleDeclarationImpl objects defined in the current VIL-script.
        Parameters:
        activeScript - the LanguageUnit object which represents the active VIL-script currently in use.
        Returns:
        a list of RuleDeclarationImpl objects or null if no such object can be found.
      • getAllVariables

        private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.VariableDeclarationImpl> getAllVariables​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
        Returns a list of all VariableDeclarationImpl objects defined in the current VIL-script.
        Parameters:
        activeScript - the LanguageUnit object which represents the active VIL-script currently in use.
        Returns:
        a list of VariableDeclarationImpl objects or null if no such object can be found.
      • getValidTypeOperationList

        private java.util.List<OperationDescriptor> getValidTypeOperationList​(org.eclipse.xtext.nodemodel.INode node)
        Returns a list of all valid operations for a specific VIL-type.
        Parameters:
        node - the INode object that holds the symbolic name for which the corresponding operations shall be found.
        Returns:
        a list of OperationDescriptor objects that define the valid operations for the given type (determined via the passed node) or null if no such object can be found.
      • getSubCallPrefix

        private java.lang.String getSubCallPrefix​(org.eclipse.xtext.nodemodel.INode node)
        Returns the prefix of a sub-call (the identifier at the left-hand side of the "." for which the call is defined).
        Parameters:
        node - the INode object (last complete node) in the VIL file. Typically, this is the ".", which is used here as the starting point for determining the prefix (the identifier left to the "."). Should never be null.
        Returns:
        the prefix as a String or an empty String if no prefix is available.
      • getMatchingType

        private java.lang.String getMatchingType​(org.eclipse.xtext.nodemodel.INode node,
                                                 java.lang.String id)
        Returns the closest matching type of an VIL element based on the identifier (the name) of the element and the corresponding node of this element in the syntax tree.
        Parameters:
        node - the base element that holds the id for which the corresponding type should be found
        id - the name (identifier) for which the corresponding type should be found.
        Returns:
        a String, which contains the type name of the VIL element. Could be empty but is never null.
      • getValidTypeOperations

        private java.util.List<OperationDescriptor> getValidTypeOperations​(java.lang.String typeName,
                                                                           org.eclipse.xtext.nodemodel.INode node)
        Get all valid VIL operation for a specific VIL (artefact) type.
        Parameters:
        typeName - the name of the VIL element for which the valid operations will be determined
        registry - the type registry to query
        Returns:
        List which contains the valid operations for the given type. Maybe null if the type is not supported or no operation for this type is defined.
      • getAvailableOperations

        private java.util.List<OperationDescriptor> getAvailableOperations​(org.eclipse.xtext.nodemodel.INode node)
        Get all VIL operations currently registered to EASy-Producer.
        Parameters:
        node - the last complete node which provides the basic information for retrieving the operations.
        Returns:
        List which contains all available operations. Maybe an empty list if no operation can be found, but never null.
      • getAvailableInstantiators

        private java.util.List<OperationDescriptor> getAvailableInstantiators​(org.eclipse.xtext.nodemodel.INode node)
        Returns a list with all available instantiators.
        Parameters:
        node - the last complete node which provides the basic information for retrieving the operations.
        Returns:
        List which contains the available instantiator operations. Can be null.
      • getType

        private java.lang.String getType​(org.eclipse.xtext.nodemodel.INode node)
        Returns the type of an variable.
        Parameters:
        node - the last complete node, after the content assist is used.
        Returns:
        a String which contains the type of the variable. Never null but maybe an empty String, if nothing was found.
      • getType

        private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl ruleDecl,
                                         java.lang.String name)
        Get the name of the type of an VIL element based on the name (identifier) of this element.
        Parameters:
        ruleDecl - RuleDeclarationImpl the parent-rule in which the element of interest is used in.
        name - String the name of the element as a string for which the type will be determined.
        Returns:
        String the name of the type of the VIL element or an empty String if the type could not be determined. Never null.
      • getType

        private java.lang.String getType​(de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression logExpr,
                                         java.lang.String name)
        Get the name of the type of an VIL element based on the name (identifier) of this element.
        Parameters:
        logExpr - a LogicalExpression in which the element of interest is used.
        name - String name of the element as a string for which the type will be determined
        Returns:
        String name of the type of the VIL element or an empty String if the type could not be determined. Never null.
      • getType

        private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock,
                                         java.lang.String name)
        Get the name of the type of an VIL element based on the name (identifier) of this element.
        Parameters:
        ruleImpl - RuleElementBlock the rule implementation (complete rule representation) in which the search for the type will start
        name - String the name of the element as a string for which the type will be determined.
        Returns:
        String name of the type of the VIL element or an empty String if the type could not be determined. Never null.
      • getType

        private java.lang.String getType​(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit script,
                                         java.lang.String name)
        Get the name of the type of an VIL element based on the name (identifier) of this element.
        Parameters:
        script - LanguageUnit script in which the search for the type will start.
        name - String name of the element as a string for which the type will be determined.
        Returns:
        String name of the type of the VIL element or an empty String if the type could not be determined. Never null.
      • getReturnType

        private java.lang.String getReturnType​(java.lang.String id,
                                               org.eclipse.xtext.nodemodel.INode node)
        Returns the returntype of an specified operation.
        Parameters:
        id - String the operationname.
        node - the last complete node, when the content assist is used.
        Returns:
        the returntype of the operation as a String. Could be empty but never null.
      • getVilFile

        private java.io.File getVilFile​(org.eclipse.emf.ecore.EObject rootObject)
        Returns the file of the VIL-Script.
        Parameters:
        rootObject - the rootModel from the ContentAssistContext.
        Returns:
        the VIL-Script file as a File. Maybe null.
      • hasElements

        private boolean hasElements​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)
        Checks if the RuleElementBlock has at least one element or not.
        Parameters:
        ruleElBlock -
        Returns:
        true if it has at least one element, false otherwise.
      • hasElements

        private boolean hasElements​(java.util.List<?> list)
        Checks if a List has Elements or not.
        Parameters:
        list -
        Returns:
        true if the List has at least one element, false if it's empty or null.
      • removeLogicalAndMathOperations

        private void removeLogicalAndMathOperations​(java.util.List<OperationDescriptor> operationList)
        Removes unneeded operations from the operationList. The unneeded ones are registered in the OPERATIONS_BLACKLIST array.
        Parameters:
        operationList -
      • getRuleParams

        private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Parameter> getRuleParams​(org.eclipse.xtext.nodemodel.INode node)
        Returns the parameters from a rule.
        Parameters:
        node - Last complete node, when the content assist is used.
        Returns:
        a List list with the Parameters from the rule. Maybe null.
      • getRuleVars

        private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleVars​(org.eclipse.xtext.nodemodel.INode node)
        Returns the variables from a rule.
        Parameters:
        node - Last complete node, when the content assist is used.
        Returns:
        a List list with the VariableDeclarations from the rule. Maybe null.
      • getRuleElementBlockVars

        private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleElementBlockVars​(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElementBlock)
        Returns all variables from the RuleElementBlock.
        Parameters:
        ruleElementBlock -
        Returns:
        a List with all variables from the RuleElementBlock. Maybe null.
      • getParentRule

        private de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl getParentRule​(org.eclipse.xtext.nodemodel.INode node)
        Returns the RuleDeclarationImpl, so the object of the rule.
        Parameters:
        node - the last complete node, which were committed, when we invoke the content assist inside of the rule.
        Returns:
        the RuleDeclarationImpl of the rule.
      • opsToDisplayString

        private java.util.List<org.eclipse.jface.viewers.StyledString> opsToDisplayString​(java.util.List<OperationDescriptor> operationsList)
        converts the operationnames into a content assist friendly format, which can be directly used to display.
        Parameters:
        operationsList -
        Returns:
        a List which contains all operations, ready to display in the content assist. Maybe null, if the List operationsList is empty.
      • varsToDisplayString

        private java.util.List<org.eclipse.jface.viewers.StyledString> varsToDisplayString​(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> varDeclList)
        converts the variablenames into a content assist friendly format, which can be directly used to display.
        Parameters:
        varDeclList -
        Returns:
        a List which contains all variables, ready to display in the content assist. Maybe null, if the List varDeclList is empty.
      • getRuleParameters

        private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleParameters​(org.eclipse.xtext.nodemodel.INode node)
        Returns all parameters defined for a specific rule. This method assumes that the semantic element of passed node is of type RuleDeclarationImpl. This must be checked before calling this method.
        Parameters:
        node - the INode object of type RuleDeclarationImpl for which the parameters shall be returned.
        Returns:
        a list of StyledString that includes all rule parameters ready for displaying in the content assist or null if no rule parameters are defined.
      • getRuleVariables

        private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleVariables​(org.eclipse.xtext.nodemodel.INode node,
                                                                                        boolean completeDefsOnly,
                                                                                        boolean addLRHS)
        Returns all variables defined for a specific rule. This includes also the implicit variables LHS and RHS. This method assumes that the semantic element of passed node is of type RuleDeclarationImpl. This must be checked before calling this method.
        Parameters:
        node - the INode object (last complete node) for which the content assist is called. The semantic element of this node must be of type RuleDeclarationImpl to determine the variables defined in this rule.
        completeDefsOnly - in order to prevent proposals of incomplete variables, i.e. if the user calls the content assist for completing a variable definition, the incomplete variable(s) must not be proposed (completeDefsOnly = true). To return all variables of the rule, use false.
        addLRHS - true to add or false to don't add LHS and RHS as a proposal, if necessary.
        Returns:
        a list of StyledString that includes all rule variables ready for displaying in the content assist or null if no rule variables are defined.