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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations