Search in sources :

Example 1 with Assignments

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

the class BrokenPartsViaReferences method collectBrokenModulesViaInvertedImports.

protected List<Module> collectBrokenModulesViaInvertedImports(final List<Module> startModules, final Map<Module, List<Module>> invertedImports) {
    final List<Module> startModulesCopy = new ArrayList<Module>(startModules);
    final List<Module> result = new ArrayList<Module>();
    final MessageConsoleStream stream = TITANDebugConsole.getConsole().newMessageStream();
    if (writeDebugInfo) {
        for (Module startModule : startModules) {
            TITANDebugConsole.println("  ** Module " + startModule.getName() + " can not be skipped as it was not yet analyzed.", stream);
        }
    }
    for (int s = 0; s < startModulesCopy.size(); ++s) {
        final Module startModule = startModulesCopy.get(s);
        if (!result.contains(startModule)) {
            result.add(startModule);
        }
        final List<Module> whereStartModuleUsed = invertedImports.get(startModule);
        for (int d = 0; d < whereStartModuleUsed.size(); ++d) {
            final Module dependentModule = whereStartModuleUsed.get(d);
            if (!startModulesCopy.contains(dependentModule)) {
                startModulesCopy.add(dependentModule);
                if (writeDebugInfo) {
                    TITANDebugConsole.println("  ** Module " + dependentModule.getName() + " can not be skipped as it depends on " + startModule.getName() + " which needs to be checked.", stream);
                }
            }
        }
        startModule.notCheckRoot();
        final Assignments assignments = startModule.getAssignments();
        for (int d = 0; d < assignments.getNofAssignments(); ++d) {
            final Assignment assignment = assignments.getAssignmentByIndex(d);
            assignment.notCheckRoot();
        }
    }
    return result;
}
Also used : Undefined_Assignment(org.eclipse.titan.designer.AST.ASN1.Undefined_Assignment) ASN1Assignment(org.eclipse.titan.designer.AST.ASN1.ASN1Assignment) Assignment(org.eclipse.titan.designer.AST.Assignment) ArrayList(java.util.ArrayList) Assignments(org.eclipse.titan.designer.AST.Assignments) MessageConsoleStream(org.eclipse.ui.console.MessageConsoleStream) Module(org.eclipse.titan.designer.AST.Module) TTCN3Module(org.eclipse.titan.designer.AST.TTCN3.definitions.TTCN3Module)

Example 2 with Assignments

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

the class ImportModule method addProposal.

// FIXME ezeket sem teszteltuk
@Override
public /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final Identifier targetModuleId) {
    final List<ISubReference> subrefs = propCollector.getReference().getSubreferences();
    if (propCollector.getReference().getModuleIdentifier() == null && subrefs.size() == 1) {
        propCollector.addProposal(identifier, ImageCache.getImage(getOutlineIcon()), KIND);
    }
    final Module savedReferredModule = referredModule;
    if (savedReferredModule != null) {
        final Assignments assignments = savedReferredModule.getAssignments();
        for (int i = 0, size = assignments.getNofAssignments(); i < size; i++) {
            final Assignment temporalAssignment = assignments.getAssignmentByIndex(i);
            if (savedReferredModule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, temporalAssignment)) {
                temporalAssignment.addProposal(propCollector, 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.addProposal(propCollector, targetModuleId);
                } else if (importation.getVisibilityModifier() == VisibilityModifier.Friend) {
                    // The import is the friendly one
                    if (ttcnmodule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, importation)) {
                        importation.addProposal(propCollector, targetModuleId);
                    }
                }
            }
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) Assignments(org.eclipse.titan.designer.AST.Assignments) Module(org.eclipse.titan.designer.AST.Module)

Example 3 with Assignments

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

the class ImportModule method addProposal.

/**
 * Adds the imported module or definitions contained in it, to the list
 * completion proposals.
 *
 * @param propCollector
 *                the proposal collector.
 * @param targetModuleId
 *                the identifier of the module where the definition will
 *                be inserted. It is used to check if it is visible
 *                there or not.
 */
@Override
public /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final Identifier targetModuleId) {
    final List<ISubReference> subrefs = propCollector.getReference().getSubreferences();
    if (propCollector.getReference().getModuleIdentifier() == null && subrefs.size() == 1) {
        propCollector.addProposal(identifier, ImageCache.getImage(getOutlineIcon()), KIND);
    }
    final Module savedReferredModule = referredModule;
    if (savedReferredModule != null) {
        final Assignments assignments = savedReferredModule.getAssignments();
        for (int i = 0, size = assignments.getNofAssignments(); i < size; i++) {
            final Assignment temporalAssignment = assignments.getAssignmentByIndex(i);
            if (savedReferredModule.isVisible(CompilationTimeStamp.getBaseTimestamp(), targetModuleId, temporalAssignment)) {
                temporalAssignment.addProposal(propCollector, 0);
            }
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) Assignments(org.eclipse.titan.designer.AST.Assignments) Module(org.eclipse.titan.designer.AST.Module)

Example 4 with Assignments

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

the class ASN1Assignments method getLocalAssignmentByID.

@Override
public /**
 * {@inheritDoc}
 */
Assignment getLocalAssignmentByID(final CompilationTimeStamp timestamp, final Identifier identifier) {
    if (null == lastUniqueNessCheckTimeStamp) {
        checkUniqueness(timestamp);
    }
    final String name = identifier.getName();
    if (assignmentMap.containsKey(name)) {
        final Assignment temp = assignmentMap.get(name);
        if (temp instanceof Undefined_Assignment) {
            final ASN1Assignment real = ((Undefined_Assignment) temp).getRealAssignment(timestamp);
            if (null != real) {
                return real;
            }
        }
        return temp;
    }
    final Assignments temp = SpecialASN1Module.getSpecialModule().getAssignments();
    if (!this.equals(temp)) {
        return temp.getLocalAssignmentByID(timestamp, identifier);
    }
    return null;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Assignments(org.eclipse.titan.designer.AST.Assignments)

Example 5 with Assignments

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

the class UnrestrictedString_Type method getTypeRefd.

@Override
public /**
 * {@inheritDoc}
 */
IType getTypeRefd(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
    if (null == myScope) {
        setIsErroneous(true);
        return this;
    }
    final Identifier identifier = new Identifier(Identifier_type.ID_ASN, "CHARACTER STRING");
    final Assignments assignments = myScope.getAssignmentsScope();
    if (!assignments.hasAssignmentWithId(timestamp, identifier)) {
        setIsErroneous(true);
        return this;
    }
    final Assignment assignment = assignments.getLocalAssignmentByID(timestamp, identifier);
    if (null == assignment || null == assignment.getType(timestamp)) {
        setIsErroneous(true);
        return this;
    }
    return assignment.getType(timestamp);
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Identifier(org.eclipse.titan.designer.AST.Identifier) 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