Search in sources :

Example 1 with ITypeWithComponents

use of org.eclipse.titan.designer.AST.ITypeWithComponents in project titan.EclipsePlug-ins by eclipse.

the class NamedValue method getDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
Declaration getDeclaration() {
    INamedNode inamedNode = getNameParent();
    while (!(inamedNode instanceof IValue)) {
        if (inamedNode == null) {
            // FIXME: this is just a temp solution! find the reason!
            return null;
        }
        inamedNode = inamedNode.getNameParent();
    }
    final IValue iValue = (IValue) inamedNode;
    IType type = iValue.getMyGovernor();
    if (type == null) {
        return null;
    }
    type = type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (type instanceof ITypeWithComponents) {
        final Identifier id = ((ITypeWithComponents) type).getComponentIdentifierByName(getName());
        return Declaration.createInstance(type.getDefiningAssignment(), id);
    }
    return null;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Identifier(org.eclipse.titan.designer.AST.Identifier) ITypeWithComponents(org.eclipse.titan.designer.AST.ITypeWithComponents) INamedNode(org.eclipse.titan.designer.AST.INamedNode) IType(org.eclipse.titan.designer.AST.IType)

Example 2 with ITypeWithComponents

use of org.eclipse.titan.designer.AST.ITypeWithComponents in project titan.EclipsePlug-ins by eclipse.

the class Enumerated_Value method getDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
Declaration getDeclaration() {
    IType type = getMyGovernor();
    if (type == null) {
        return null;
    }
    type = type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (type instanceof ITypeWithComponents) {
        final Identifier resultId = ((ITypeWithComponents) type).getComponentIdentifierByName(value);
        return Declaration.createInstance(type.getDefiningAssignment(), resultId);
    }
    return null;
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ITypeWithComponents(org.eclipse.titan.designer.AST.ITypeWithComponents) IType(org.eclipse.titan.designer.AST.IType)

Example 3 with ITypeWithComponents

use of org.eclipse.titan.designer.AST.ITypeWithComponents in project titan.EclipsePlug-ins by eclipse.

the class EnumItem method getDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
Declaration getDeclaration() {
    if (getMyScope() == null) {
        return null;
    }
    final Module module = getMyScope().getModuleScope();
    final Assignment assignment = module.getEnclosingAssignment(getLocation().getOffset());
    final IType type = assignment.getType(CompilationTimeStamp.getBaseTimestamp());
    if (type instanceof ITypeWithComponents) {
        final Identifier id = ((ITypeWithComponents) type).getComponentIdentifierByName(getId());
        return Declaration.createInstance(assignment, id);
    }
    return null;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Identifier(org.eclipse.titan.designer.AST.Identifier) ITypeWithComponents(org.eclipse.titan.designer.AST.ITypeWithComponents) Module(org.eclipse.titan.designer.AST.Module) IType(org.eclipse.titan.designer.AST.IType)

Example 4 with ITypeWithComponents

use of org.eclipse.titan.designer.AST.ITypeWithComponents in project titan.EclipsePlug-ins by eclipse.

the class CompField method getDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
Declaration getDeclaration() {
    INamedNode inamedNode = getNameParent();
    while (!(inamedNode instanceof Definition)) {
        if (inamedNode == null) {
            // FIXME: this is just a temp solution! find the reason!
            return null;
        }
        inamedNode = inamedNode.getNameParent();
    }
    final Definition namedTemplList = (Definition) inamedNode;
    IType tempType = namedTemplList.getType(CompilationTimeStamp.getBaseTimestamp());
    if (tempType == null) {
        return null;
    }
    tempType = tempType.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (tempType instanceof ITypeWithComponents) {
        final Identifier resultId = ((ITypeWithComponents) tempType).getComponentIdentifierByName(getIdentifier());
        return Declaration.createInstance(tempType.getDefiningAssignment(), resultId);
    }
    return null;
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ITypeWithComponents(org.eclipse.titan.designer.AST.ITypeWithComponents) INamedNode(org.eclipse.titan.designer.AST.INamedNode) Definition(org.eclipse.titan.designer.AST.TTCN3.definitions.Definition) IType(org.eclipse.titan.designer.AST.IType)

Example 5 with ITypeWithComponents

use of org.eclipse.titan.designer.AST.ITypeWithComponents in project titan.EclipsePlug-ins by eclipse.

the class NamedTemplate method getDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
Declaration getDeclaration() {
    INamedNode inamedNode = getNameParent();
    while (!(inamedNode instanceof Named_Template_List)) {
        if (inamedNode == null) {
            // FIXME: this is just a temp solution! find the reason!
            return null;
        }
        inamedNode = inamedNode.getNameParent();
    }
    final Named_Template_List namedTemplList = (Named_Template_List) inamedNode;
    IType type = namedTemplList.getMyGovernor();
    if (type == null) {
        return null;
    }
    type = type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
    if (type instanceof ITypeWithComponents) {
        final Identifier id = ((ITypeWithComponents) type).getComponentIdentifierByName(getName());
        return Declaration.createInstance(type.getDefiningAssignment(), id);
    }
    return null;
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ITypeWithComponents(org.eclipse.titan.designer.AST.ITypeWithComponents) INamedNode(org.eclipse.titan.designer.AST.INamedNode) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

IType (org.eclipse.titan.designer.AST.IType)5 ITypeWithComponents (org.eclipse.titan.designer.AST.ITypeWithComponents)5 Identifier (org.eclipse.titan.designer.AST.Identifier)5 INamedNode (org.eclipse.titan.designer.AST.INamedNode)3 Assignment (org.eclipse.titan.designer.AST.Assignment)1 IValue (org.eclipse.titan.designer.AST.IValue)1 Module (org.eclipse.titan.designer.AST.Module)1 Definition (org.eclipse.titan.designer.AST.TTCN3.definitions.Definition)1