public class VilBuildLangProposalProviderUtility
extends java.lang.Object
| Modifier and Type | Field and 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.
|
| Modifier | Constructor and Description |
|---|---|
private |
VilBuildLangProposalProviderUtility()
Prevents external creation.
|
| Modifier and Type | Method and 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.
|
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. |
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<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(org.eclipse.xtext.nodemodel.INode node)
Returns the type of an variable.
|
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.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.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.util.List<OperationDescriptor> |
getValidTypeOperationList(org.eclipse.xtext.nodemodel.INode node)
Returns a list of all valid operations for a specific VIL-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.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.
|
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(java.util.List<?> list)
Checks if a
List |
private boolean |
hasElements(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)
Checks if the
RuleElementBlock has at least one element 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.
|
public static final VilBuildLangProposalProviderUtility INSTANCE
private static final java.lang.String[] OPERATIONS_BLACKLIST
private VilBuildLangProposalProviderUtility()
public java.util.List<org.eclipse.jface.viewers.StyledString> getScriptParameters(org.eclipse.xtext.nodemodel.INode node)
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.StyledString that includes all script parameters ready for displaying in the
content assist or null if no script parameters are defined.public java.util.List<org.eclipse.jface.viewers.StyledString> getAllRules(org.eclipse.xtext.nodemodel.INode node,
boolean deleteSelf)
StyledString including name
and parameter list.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.StyledString that includes all rules ready for displaying in the content assist or
null if no rule parameters are defined.public java.util.List<org.eclipse.jface.viewers.StyledString> getScriptVariables(org.eclipse.xtext.nodemodel.INode node,
boolean completeDefsOnly)
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.StyledString that includes all script variables ready for displaying in the content assist
or null if no script variables are defined.public java.lang.String getVilFileName(org.eclipse.emf.ecore.EObject rootObject)
rootObject - the root element of the current context. Typically this is the ImplementationUnit.public java.lang.String getIvmlModelName(org.eclipse.emf.ecore.EObject rootObject)
rootObject - the root element of the current context. Typically this is the ImplementationUnit.public java.util.List<java.lang.String> getAllTypes(org.eclipse.xtext.nodemodel.INode node)
node - the INode object (last complete node) for which the content assist is called.String) of all types currently registered to EASy-Producer.public boolean hasVersion(org.eclipse.xtext.nodemodel.INode node)
node - the INode object (last complete node) for which the content assist is called.public boolean hasScript(org.eclipse.xtext.nodemodel.INode node)
node - the INode object (last complete node) for which the content assist is called.public java.util.List<org.eclipse.jface.viewers.StyledString> getValidTypeOperations(org.eclipse.xtext.nodemodel.INode node,
boolean returnAll)
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.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.public java.util.List<org.eclipse.jface.viewers.StyledString> getOperationsMatchingReturnType(org.eclipse.xtext.nodemodel.INode node)
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.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.public java.util.List<org.eclipse.jface.viewers.StyledString> getAllInstantiators(org.eclipse.xtext.nodemodel.INode node)
node - the INode object (last complete node) for which the content assist is called.StyledString that includes all instantiators currently available in EASy-Producer
ready for displaying in the content assist or null if no instantiators are available.public java.util.List<org.eclipse.jface.viewers.StyledString> getParentParameters(org.eclipse.xtext.nodemodel.INode node)
Map elements or surrounding
Rule elements. Parameters or other elements from, e.g., a script must be determined using getScriptParameters.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.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.public java.util.List<org.eclipse.jface.viewers.StyledString> getParentVariables(org.eclipse.xtext.nodemodel.INode node,
boolean completeDefsOnly)
Map elements or surrounding
Rule elements. Variables or other elements from, e.g., a script must be determined using getScriptVariables.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 falseStyledString 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.public java.util.List<java.lang.String> searchForRuleParameterTypes(java.lang.String toSearch,
org.eclipse.xtext.nodemodel.INode node)
List with the types of the parameters from the rule, which is searched.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.List with the parameter types. Can be null.public de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.CallImpl getCallImpl(org.eclipse.xtext.nodemodel.INode node)
CallImpl from a node.
This method should only be used in a parameter-complete method.node - the last complete node.CallImpl from the node. Maybe null, if no CallImpl was
found.public de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.ExpressionOrQualifiedExecutionImpl getExprOrExecution(org.eclipse.xtext.nodemodel.INode node)
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)
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.List with all proposals, which are ready to display in the content assist.
Maybe null if no variables found.public boolean isMainRuleDeclared(org.eclipse.xtext.nodemodel.INode node)
public java.lang.String getScriptParametersForMainRule(org.eclipse.xtext.nodemodel.INode node)
private de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit getActiveVilScript(org.eclipse.xtext.nodemodel.INode node)
node - the INode object (last complete node) for which the content assist is called.LanguageUnit object or null if no such
object can be found.private java.util.List<de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl> getAllRules(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
RuleDeclarationImpl objects defined in the current VIL-script.activeScript - the LanguageUnit object which represents the active VIL-script currently in use.RuleDeclarationImpl objects or null if no such object can be found.private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.impl.VariableDeclarationImpl> getAllVariables(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit activeScript)
VariableDeclarationImpl objects defined in the current VIL-script.activeScript - the LanguageUnit object which represents the active VIL-script currently in use.VariableDeclarationImpl objects or null if no such object can be found.private java.util.List<OperationDescriptor> getValidTypeOperationList(org.eclipse.xtext.nodemodel.INode node)
node - the INode object that holds the symbolic name for which the corresponding operations
shall be found.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.private java.lang.String getSubCallPrefix(org.eclipse.xtext.nodemodel.INode node)
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.String or an empty String if no prefix is available.private java.lang.String getMatchingType(org.eclipse.xtext.nodemodel.INode node,
java.lang.String id)
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.private java.util.List<OperationDescriptor> getValidTypeOperations(java.lang.String typeName, org.eclipse.xtext.nodemodel.INode node)
typeName - the name of the VIL element for which the valid operations will be determinedregistry - the type registry to queryList 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.private java.util.List<OperationDescriptor> getAvailableOperations(org.eclipse.xtext.nodemodel.INode node)
node - the last complete node which provides the basic information for retrieving the operations.List which contains all available operations. Maybe an empty list
if no operation can be found, but never null. private java.util.List<OperationDescriptor> getAvailableInstantiators(org.eclipse.xtext.nodemodel.INode node)
node - the last complete node which provides the basic information for retrieving the operations.List which contains the available instantiator operations. Can be null.private java.lang.String getType(org.eclipse.xtext.nodemodel.INode node)
node - the last complete node, after the content assist is used.String which contains the type of the variable. Never null but maybe an empty String, if nothing
was found.private java.lang.String getType(de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl ruleDecl,
java.lang.String name)
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.String the name of the type of the VIL element or an empty String if the type
could not be determined. Never null.private java.lang.String getType(de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression logExpr,
java.lang.String name)
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 determinedString name of the type of the VIL element or an empty String if the type
could not be determined. Never null.private java.lang.String getType(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock,
java.lang.String name)
ruleImpl - RuleElementBlock the rule implementation (complete rule representation) in which the search
for the type will startname - String the name of the element as a string for which the type will be determined.String name of the type of the VIL element or an empty String if the type
could not be determined. Never null.private java.lang.String getType(de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit script,
java.lang.String name)
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.String name of the type of the VIL element or an empty String if the type
could not be determined. Never null.private java.lang.String getReturnType(java.lang.String id,
org.eclipse.xtext.nodemodel.INode node)
id - String the operationname.node - the last complete node, when the content assist is used.String. Could be empty but never null.private java.io.File getVilFile(org.eclipse.emf.ecore.EObject rootObject)
rootObject - the rootModel from the ContentAssistContext.File. Maybe null.private boolean hasElements(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElBlock)
RuleElementBlock has at least one element or not.ruleElBlock - private boolean hasElements(java.util.List<?> list)
List> has Elements or not.list - private void removeLogicalAndMathOperations(java.util.List<OperationDescriptor> operationList)
OPERATIONS_BLACKLIST array.operationList - private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Parameter> getRuleParams(org.eclipse.xtext.nodemodel.INode node)
node - Last complete node, when the content assist is used.List list with the Parameters from the rule. Maybe null.private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleVars(org.eclipse.xtext.nodemodel.INode node)
node - Last complete node, when the content assist is used.List list with the VariableDeclarations from the rule.
Maybe null.private java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> getRuleElementBlockVars(de.uni_hildesheim.sse.vilBuildLanguage.RuleElementBlock ruleElementBlock)
RuleElementBlock.ruleElementBlock - List with all variables from the RuleElementBlock.
Maybe null.private de.uni_hildesheim.sse.vilBuildLanguage.impl.RuleDeclarationImpl getParentRule(org.eclipse.xtext.nodemodel.INode node)
RuleDeclarationImpl, so the object of the rule.node - the last complete node, which were committed, when we invoke the content assist inside of the rule.RuleDeclarationImpl of the rule.private java.util.List<org.eclipse.jface.viewers.StyledString> opsToDisplayString(java.util.List<OperationDescriptor> operationsList)
operationsList - List which contains all operations, ready to display in the content assist.
Maybe null, if the Listprivate java.util.List<org.eclipse.jface.viewers.StyledString> varsToDisplayString(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> varDeclList)
varDeclList - List which contains all variables, ready to display in the content assist.
Maybe null, if the List varDeclList is empty.private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleParameters(org.eclipse.xtext.nodemodel.INode node)
RuleDeclarationImpl. This must be checked before calling this method.node - the INode object of type RuleDeclarationImpl for which the parameters shall be
returned.StyledString that includes all rule parameters ready for displaying in the
content assist or null if no rule parameters are defined.private java.util.List<org.eclipse.jface.viewers.StyledString> getRuleVariables(org.eclipse.xtext.nodemodel.INode node,
boolean completeDefsOnly,
boolean addLRHS)
RuleDeclarationImpl. This must be
checked before calling this method.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.StyledString that includes all rule variables ready for displaying in the content assist
or null if no rule variables are defined.Copyright © 2009 - 2018 SSE. All Rights Reserved.