use of org.yakindu.base.types.Property in project statecharts by Yakindu.
the class ExpressionsJavaValidator method checkAssignmentToFinalVariable.
@Check(CheckType.FAST)
public void checkAssignmentToFinalVariable(AssignmentExpression exp) {
Expression varRef = exp.getVarRef();
EObject referencedObject = null;
if (varRef instanceof FeatureCall)
referencedObject = ((FeatureCall) varRef).getFeature();
else if (varRef instanceof ElementReferenceExpression)
referencedObject = ((ElementReferenceExpression) varRef).getReference();
if (referencedObject instanceof Property) {
if (((Property) referencedObject).isConst()) {
error(ERROR_ASSIGNMENT_TO_CONST_MSG, ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION__VAR_REF, ERROR_ASSIGNMENT_TO_CONST_CODE);
}
}
}
use of org.yakindu.base.types.Property in project statecharts by Yakindu.
the class AbstractTypeSystemTest method createProperty.
protected Property createProperty(String name) {
Property property = TypesFactory.eINSTANCE.createProperty();
property.setName(name);
return property;
}
use of org.yakindu.base.types.Property in project statecharts by Yakindu.
the class SGenScopeProvider method getElementReferenceScope.
protected IScope getElementReferenceScope(EObject context) {
GeneratorModel generatorModel = (GeneratorModel) EcoreUtil.getRootContainer(context);
EList<PropertyDefinition> properties = generatorModel.getProperties();
List<Property> all = buildInDeclarations.getDeclarations();
return Scopes.scopeFor(properties, Scopes.scopeFor(all));
}
use of org.yakindu.base.types.Property in project statecharts by Yakindu.
the class RenameRefactoringTest method testRenameVariable.
@Test
public void testRenameVariable() {
Statechart initial = models.loadStatechartFromResource(RENAMING + INITIAL_STATECHART);
// get element to rename
Property someVariable = null;
EList<Scope> scopes = initial.getScopes();
for (Scope scope : scopes) {
if (scope instanceof InterfaceScope) {
InterfaceScope iScope = (InterfaceScope) scope;
someVariable = iScope.getVariables().get(0);
}
}
Statechart expected = models.loadStatechartFromResource(RENAMING + "AfterRenamingVariable.sct");
testRenaming(initial, expected, someVariable, "someNewVariableName");
}
use of org.yakindu.base.types.Property in project statecharts by Yakindu.
the class PropertyItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
Property variable = (Property) object;
StringBuilder builder = new StringBuilder();
if (variable.getName() != null) {
builder.append(variable.getName());
builder.append(" : ");
}
if (variable.getType() != null)
builder.append(variable.getType().getName());
else
builder.append("unknown");
return builder.toString();
}
Aggregations