Search in sources :

Example 16 with Assignments

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

the class ImportModule method addDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
void addDeclaration(final DeclarationCollector declarationCollector, final Identifier targetModuleId) {
    final Module savedReferredModule = referredModule;
    if (savedReferredModule != null) {
        final Assignments assignments = savedReferredModule.getAssignments();
        for (int i = 0; i < assignments.getNofAssignments(); i++) {
            final Assignment temporalAssignment = assignments.getAssignmentByIndex(i);
            if (savedReferredModule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, temporalAssignment)) {
                temporalAssignment.addDeclaration(declarationCollector, 0);
            }
        }
        if (savedReferredModule instanceof TTCN3Module) {
            final TTCN3Module ttcnmodule = (TTCN3Module) savedReferredModule;
            final List<ImportModule> imports = ttcnmodule.getImports();
            for (final ImportModule importation : imports) {
                if (importation.getVisibilityModifier() == VisibilityModifier.Public) {
                    importation.addDeclaration(declarationCollector, targetModuleId);
                } else if (importation.getVisibilityModifier() == VisibilityModifier.Friend) {
                    // one
                    if (ttcnmodule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, importation)) {
                        importation.addDeclaration(declarationCollector, targetModuleId);
                    }
                }
            }
        }
        final Identifier moduleId = declarationCollector.getReference().getModuleIdentifier();
        final List<ISubReference> subrefs = declarationCollector.getReference().getSubreferences();
        if (moduleId == null && subrefs.size() == 1 && identifier.getName().equals(subrefs.get(0).getId().getName())) {
            declarationCollector.addDeclaration(savedReferredModule.getIdentifier().getDisplayName(), savedReferredModule.getIdentifier().getLocation(), (Assignment) null);
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) Identifier(org.eclipse.titan.designer.AST.Identifier) Assignments(org.eclipse.titan.designer.AST.Assignments) Module(org.eclipse.titan.designer.AST.Module)

Example 17 with Assignments

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

the class ImportModule method hasImportedAssignmentWithID.

@Override
public /**
 * {@inheritDoc}
 */
boolean hasImportedAssignmentWithID(final CompilationTimeStamp timestamp, final Identifier identifier) {
    if (referredModule == null) {
        return false;
    }
    if (hasImportOfImport) {
        if (referredModule instanceof TTCN3Module) {
            final TTCN3Module ttcnmodule = (TTCN3Module) referredModule;
            final List<ImportModule> imports = ttcnmodule.getImports();
            for (final ImportModule importation : imports) {
                if (importation.hasImportedAssignmentWithID(timestamp, identifier)) {
                    return true;
                }
            }
        }
    }
    if (hasNormalImport) {
        final Assignments assignments = referredModule.getAssignments();
        if (assignments != null && assignments.hasLocalAssignmentWithID(timestamp, identifier)) {
            return true;
        }
    }
    return false;
}
Also used : Assignments(org.eclipse.titan.designer.AST.Assignments)

Aggregations

Assignments (org.eclipse.titan.designer.AST.Assignments)17 Assignment (org.eclipse.titan.designer.AST.Assignment)13 Module (org.eclipse.titan.designer.AST.Module)9 Identifier (org.eclipse.titan.designer.AST.Identifier)7 ArrayList (java.util.ArrayList)4 ISubReference (org.eclipse.titan.designer.AST.ISubReference)4 ASN1Assignment (org.eclipse.titan.designer.AST.ASN1.ASN1Assignment)3 Undefined_Assignment (org.eclipse.titan.designer.AST.ASN1.Undefined_Assignment)3 Location (org.eclipse.titan.designer.AST.Location)3 TTCN3Module (org.eclipse.titan.designer.AST.TTCN3.definitions.TTCN3Module)3 IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)2 NULL_Location (org.eclipse.titan.designer.AST.NULL_Location)2 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)2 IFile (org.eclipse.core.resources.IFile)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 RewriteSessionEditProcessor (org.eclipse.jface.text.RewriteSessionEditProcessor)1 TextSelection (org.eclipse.jface.text.TextSelection)1 InsertEdit (org.eclipse.text.edits.InsertEdit)1 MultiTextEdit (org.eclipse.text.edits.MultiTextEdit)1 CfgLocation (org.eclipse.titan.common.parsers.cfg.CfgLocation)1