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