Class VilBuildLangProposalProviderUtility
- java.lang.Object
-
- de.uni_hildesheim.sse.ui.contentassist.VilBuildLangProposalProviderUtility
-
public class VilBuildLangProposalProviderUtility extends java.lang.ObjectA 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 VilBuildLangProposalProviderUtilityINSTANCEThe current instance of the utility class.private static java.lang.String[]OPERATIONS_BLACKLISTList of logical and arithmetic operations that is used to remove such operations from the operations list before returning it to the proposal provider.
-
Constructor Summary
Constructors Modifier Constructor Description privateVilBuildLangProposalProviderUtility()Prevents external creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnitgetActiveVilScript(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 allRuleDeclarationImplobjects 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 aStyledStringincluding 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 allVariableDeclarationImplobjects 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.CallImplgetCallImpl(org.eclipse.xtext.nodemodel.INode node)Tries to filter theCallImplfrom a node.de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.ExpressionOrQualifiedExecutionImplgetExprOrExecution(org.eclipse.xtext.nodemodel.INode node)java.lang.StringgetIvmlModelName(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.StringgetMatchingType(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.RuleDeclarationImplgetParentRule(org.eclipse.xtext.nodemodel.INode node)Returns theRuleDeclarationImpl, 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.StringgetReturnType(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 theRuleElementBlock.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.StringgetScriptParametersForMainRule(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.StringgetSubCallPrefix(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.StringgetType(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.StringgetType(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.StringgetType(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.StringgetType(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.StringgetType(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.FilegetVilFile(org.eclipse.emf.ecore.EObject rootObject)Returns the file of the VIL-Script.java.lang.StringgetVilFileName(org.eclipse.emf.ecore.EObject rootObject)Returns the name of the current VIL file.private booleanhasElements(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)Checks if theRuleElementBlockhas at least one element or not.private booleanhasElements(java.util.List<?> list)Checks if aList>has Elements or not.booleanhasScript(org.eclipse.xtext.nodemodel.INode node)Checks whether a script is defined as part of the current VIL-file.booleanhasVersion(org.eclipse.xtext.nodemodel.INode node)Checks whether the current VIL-build script has a version.booleanisMainRuleDeclared(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 voidremoveLogicalAndMathOperations(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 aListwith 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.
-
-
-
Field Detail
-
INSTANCE
public static final VilBuildLangProposalProviderUtility INSTANCE
The current instance of the utility class. Prevent parallel access to the parse tree.
-
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 "=".
-
-
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- theINodeobject (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
StyledStringthat 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 aStyledStringincluding name and parameter list.- Parameters:
node- theINodeobject (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
StyledStringthat 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- theINodeobject (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
StyledStringthat 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 theImplementationUnit.- 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 theImplementationUnit.- 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- theINodeobject (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- theINodeobject (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- theINodeobject (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- theINodeobject (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
StyledStringthat 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- theINodeobject (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
StyledStringthat 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- theINodeobject (last complete node) for which the content assist is called.- Returns:
- a list of
StyledStringthat 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 ofMapelements or surroundingRuleelements. Parameters or other elements from, e.g., a script must be determined usinggetScriptParameters.- Parameters:
node- theINodeobject (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
StyledStringthat includes all parameters of all surrounding VIL-elements (MapandRule) 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 ofMapelements or surroundingRuleelements. Variables or other elements from, e.g., a script must be determined usinggetScriptVariables.- Parameters:
node- theINodeobject (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
StyledStringthat includes all variables of all surrounding VIL-elements (MapandRule) 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 aListwith 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:
Listwith 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 theCallImplfrom a node. This method should only be used in a parameter-complete method.- Parameters:
node- the last complete node.- Returns:
- the
CallImplfrom the node. Maybe null, if noCallImplwas 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- theListwith all types.completeDefsOnly- true if you only want full declared variables, false if you don't.- Returns:
- a
Listwith 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- theINodeobject (last complete node) for which the content assist is called.- Returns:
- the active VIL-script in terms of a
LanguageUnitobject 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 allRuleDeclarationImplobjects defined in the current VIL-script.- Parameters:
activeScript- theLanguageUnitobject which represents the active VIL-script currently in use.- Returns:
- a list of
RuleDeclarationImplobjects 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 allVariableDeclarationImplobjects defined in the current VIL-script.- Parameters:
activeScript- theLanguageUnitobject which represents the active VIL-script currently in use.- Returns:
- a list of
VariableDeclarationImplobjects 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- theINodeobject that holds the symbolic name for which the corresponding operations shall be found.- Returns:
- a list of
OperationDescriptorobjects 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- theINodeobject (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 benull.- Returns:
- the prefix as a
Stringor an emptyStringif 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 foundid- 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 determinedregistry- the type registry to query- Returns:
Listwhich 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:
Listwhich 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:
Listwhich 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
Stringwhich contains the type of the variable. Never null but maybe an emptyString, 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-RuleDeclarationImplthe parent-rule in which the element of interest is used in.name-Stringthe name of the element as a string for which the type will be determined.- Returns:
Stringthe name of the type of the VIL element or an emptyStringif 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- aLogicalExpressionin which the element of interest is used.name-Stringname of the element as a string for which the type will be determined- Returns:
Stringname of the type of the VIL element or an emptyStringif 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-RuleElementBlockthe rule implementation (complete rule representation) in which the search for the type will startname-Stringthe name of the element as a string for which the type will be determined.- Returns:
Stringname of the type of the VIL element or an emptyStringif 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-LanguageUnitscript in which the search for the type will start.name-Stringname of the element as a string for which the type will be determined.- Returns:
Stringname of the type of the VIL element or an emptyStringif 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-Stringthe 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 theContentAssistContext.- Returns:
- the VIL-Script file as a
File. Maybe null.
-
hasElements
private boolean hasElements(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)
Checks if theRuleElementBlockhas 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 aList>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 theOPERATIONS_BLACKLISTarray.- 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
Listlist with theParameters 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
Listlist with theVariableDeclarations 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 theRuleElementBlock.- Parameters:
ruleElementBlock-- Returns:
- a
Listwith all variables from theRuleElementBlock. Maybe null.
-
getParentRule
private de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl getParentRule(org.eclipse.xtext.nodemodel.INode node)
Returns theRuleDeclarationImpl, 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
RuleDeclarationImplof 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
Listwhich contains all operations, ready to display in the content assist. Maybe null, if the ListoperationsList 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
Listwhich contains all variables, ready to display in the content assist. Maybe null, if theListvarDeclList 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 typeRuleDeclarationImpl. This must be checked before calling this method.- Parameters:
node- theINodeobject of typeRuleDeclarationImplfor which the parameters shall be returned.- Returns:
- a list of
StyledStringthat 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 typeRuleDeclarationImpl. This must be checked before calling this method.- Parameters:
node- theINodeobject (last complete node) for which the content assist is called. The semantic element of this node must be of typeRuleDeclarationImplto 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
StyledStringthat includes all rule variables ready for displaying in the content assist or null if no rule variables are defined.
-
-