Search in sources :

Example 81 with Identifier

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

the class InsertFieldWizardInputPage method checkName.

public void checkName() {
    final Identifier id = new Identifier(Identifier_type.ID_TTCN, nameField.getText().trim());
    settings.setId(id);
    if (!Identifier.isValidInTtcn(settings.getId().getName())) {
        nameErrorMessage = INVALIDNAME;
        nameDone = false;
    } else {
        final IType type = selection.getType(CompilationTimeStamp.getBaseTimestamp());
        if (type instanceof TTCN3_Sequence_Type || type instanceof TTCN3_Set_Type) {
            final TTCN3_Set_Seq_Choice_BaseType ss = (TTCN3_Set_Seq_Choice_BaseType) type;
            if (ss.hasComponentWithName(settings.getId().getName())) {
                nameErrorMessage = NAMEEXISTS;
                nameDone = false;
            } else {
                nameErrorMessage = "";
                nameDone = true;
            }
        }
    }
    setErrorMessage(positionErrorMessage + typeErrorMessage + nameErrorMessage + valueErrorMessage);
    setPageComplete(posDone && typeDone && nameDone && valueDone);
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) TTCN3_Set_Seq_Choice_BaseType(org.eclipse.titan.designer.AST.TTCN3.types.TTCN3_Set_Seq_Choice_BaseType) TTCN3_Sequence_Type(org.eclipse.titan.designer.AST.TTCN3.types.TTCN3_Sequence_Type) TTCN3_Set_Type(org.eclipse.titan.designer.AST.TTCN3.types.TTCN3_Set_Type) IType(org.eclipse.titan.designer.AST.IType)

Example 82 with Identifier

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

the class FunctionContext method createLogParts_internal.

@Override
protected List<String> createLogParts_internal(final Set<String> idsAlreadyHandled) {
    final List<String> ret = new ArrayList<String>();
    if (paramIds == null) {
        return ret;
    }
    for (Identifier id : paramIds) {
        final String idS = id.toString();
        if (idsAlreadyHandled.contains(idS)) {
            continue;
        }
        idsAlreadyHandled.add(idS);
        ret.add(formatLogPart(idS));
    }
    return ret;
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ArrayList(java.util.ArrayList)

Example 83 with Identifier

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

the class ModuleGraphGenerator method createGraph.

@Override
protected void createGraph() {
    // analyze the project if needed
    final ProjectSourceParser sourceParser = GlobalParser.getProjectSourceParser(project);
    if (sourceParser.getLastTimeChecked() == null) {
        WorkspaceJob job = sourceParser.analyzeAll();
        while (job == null) {
            try {
                Thread.sleep(500);
                job = sourceParser.analyzeAll();
            } catch (InterruptedException e) {
                ErrorReporter.logExceptionStackTrace("Error while waiting for analyzis result", e);
            }
        }
        try {
            job.join();
        } catch (InterruptedException e) {
            ErrorReporter.logExceptionStackTrace("Error while parsing the project", e);
        }
    }
    final List<IProject> visitedProjects = ProjectBasedBuilder.getProjectBasedBuilder(project).getAllReachableProjects();
    final Map<String, Identifier> globalKnownModules = new HashMap<String, Identifier>();
    for (int i = 0; i < visitedProjects.size(); ++i) {
        final IProject currentProject = visitedProjects.get(i);
        final ProjectStructureDataCollector collector = GlobalProjectStructureTracker.getDataCollector(currentProject);
        collector.evaulateMissingModules();
        // adding known modules
        for (final Identifier moduleName : collector.knownModules.values()) {
            final NodeDescriptor actNode = new NodeDescriptor(moduleName.getDisplayName(), moduleName.getName(), currentProject, false, moduleName.getLocation());
            globalKnownModules.put(moduleName.getName(), moduleName);
            if (!graph.containsVertex(actNode)) {
                graph.addVertex(actNode);
                labels.put(actNode.getName(), actNode);
            }
        }
        // adding missing modules
        for (final Identifier moduleName : collector.missingModules.values()) {
            if (!globalKnownModules.containsKey(moduleName.getName())) {
                final NodeDescriptor actNode = new NodeDescriptor(moduleName.getDisplayName(), moduleName.getName(), currentProject, true, moduleName.getLocation());
                if (!graph.containsVertex(actNode)) {
                    graph.addVertex(actNode);
                    labels.put(actNode.getName(), actNode);
                }
            }
        }
        // building edges
        for (final String from : collector.importations.keySet()) {
            for (final String to : collector.importations.get(from)) {
                final EdgeDescriptor edge = new EdgeDescriptor(from + "->" + to, Color.black);
                // if(!graph.containsEdge(edge))
                graph.addEdge(edge, labels.get(from), labels.get(to), EdgeType.DIRECTED);
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) NodeDescriptor(org.eclipse.titanium.graph.components.NodeDescriptor) EdgeDescriptor(org.eclipse.titanium.graph.components.EdgeDescriptor) ProjectSourceParser(org.eclipse.titan.designer.parsers.ProjectSourceParser) IProject(org.eclipse.core.resources.IProject) Identifier(org.eclipse.titan.designer.AST.Identifier) ProjectStructureDataCollector(org.eclipse.titan.designer.parsers.ProjectStructureDataCollector)

Example 84 with Identifier

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

the class OutlinePage method selectionChanged.

@Override
public void selectionChanged(final SelectionChangedEvent event) {
    super.selectionChanged(event);
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        return;
    }
    Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
    Identifier identifier = null;
    if (selectedElement instanceof IOutlineElement) {
        identifier = ((IOutlineElement) selectedElement).getIdentifier();
    }
    if (identifier == null || identifier.getLocation() == null) {
        return;
    }
    Location location = identifier.getLocation();
    editor.selectAndReveal(location.getOffset(), location.getEndOffset() - location.getOffset());
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement) Location(org.eclipse.titan.designer.AST.Location)

Example 85 with Identifier

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

the class SelectionFinder method createModuleParListForSaving.

public String createModuleParListForSaving() {
    if (modulePars == null || modulePars.isEmpty()) {
        return "<empty>";
    }
    final List<ModuleParListRecord> records = new ArrayList<ModuleParListRecord>();
    for (Def_ModulePar def : modulePars) {
        final IResource f = def.getLocation().getFile();
        if (!(f instanceof IFile)) {
            ErrorReporter.logError("ExtractModulePar/SelectionFinder: IResource `" + f.getName() + "' is not an IFile.");
            continue;
        }
        final Identifier id = def.getIdentifier();
        final Type t = def.getType(CompilationTimeStamp.getBaseTimestamp());
        records.add(new ModuleParListRecord(def.getMyScope().getModuleScope().getIdentifier().getDisplayName(), id.getDisplayName(), t.getTypename()));
    }
    // 
    Collections.sort(records);
    final StringBuilder sb = new StringBuilder();
    for (ModuleParListRecord rec : records) {
        sb.append(rec.toString()).append('\n');
    }
    return sb.toString();
}
Also used : Type(org.eclipse.titan.designer.AST.Type) IFile(org.eclipse.core.resources.IFile) Identifier(org.eclipse.titan.designer.AST.Identifier) ArrayList(java.util.ArrayList) Def_ModulePar(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_ModulePar) IResource(org.eclipse.core.resources.IResource)

Aggregations

Identifier (org.eclipse.titan.designer.AST.Identifier)176 IType (org.eclipse.titan.designer.AST.IType)75 ISubReference (org.eclipse.titan.designer.AST.ISubReference)57 IValue (org.eclipse.titan.designer.AST.IValue)39 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)38 Type (org.eclipse.titan.designer.AST.Type)35 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)33 Assignment (org.eclipse.titan.designer.AST.Assignment)25 ArrayList (java.util.ArrayList)24 Location (org.eclipse.titan.designer.AST.Location)24 Reference (org.eclipse.titan.designer.AST.Reference)22 Module (org.eclipse.titan.designer.AST.Module)21 HashMap (java.util.HashMap)16 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)15 ASN1_Choice_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type)12 Value (org.eclipse.titan.designer.AST.Value)12 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)11 IASN1Type (org.eclipse.titan.designer.AST.ASN1.IASN1Type)10 ASN1_Sequence_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Sequence_Type)10 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)10