use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class TypeScopeWithWildcardImports method getSingleElement.
@Override
public IEObjectDescription getSingleElement(QualifiedName name) {
for (int i = 0; i < imports.length; i++) {
ImportNormalizer[] chunk = imports[i];
IEObjectDescription result = null;
for (int j = 0; j < chunk.length; j++) {
ImportNormalizer normalizer = chunk[j];
QualifiedName resolvedName = normalizer.resolve(name);
if (resolvedName != null) {
IEObjectDescription candidate = typeScope.getSingleElement(resolvedName, true);
if (candidate != null) {
if (result == null) {
result = candidate;
} else {
return null;
}
}
}
}
if (result != null) {
return result;
}
}
return getSingleElementFromParent(name);
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class Declarators method getDeclaratorData.
public Declarators.DeclaratorsData getDeclaratorData(final TargetURIs targetURIs, final IReferenceFinder.IResourceAccess resourceAccess) {
Declarators.DeclaratorsData result = targetURIs.<Declarators.DeclaratorsData>getUserData(Declarators.KEY);
if ((result != null)) {
return result;
}
final HashSet<QualifiedName> declaratorNames = CollectionLiterals.<QualifiedName>newHashSet();
final Consumer<URI> _function = (URI uri) -> {
final IUnitOfWork<Object, ResourceSet> _function_1 = (ResourceSet it) -> {
Object _xblockexpression = null;
{
final Consumer<URI> _function_2 = (URI objectURI) -> {
final EObject object = it.getEObject(objectURI, true);
if ((object != null)) {
final JvmType type = EcoreUtil2.<JvmType>getContainerOfType(object, JvmType.class);
if ((type != null)) {
QualifiedName _lowerCase = this.nameConverter.toQualifiedName(type.getIdentifier()).toLowerCase();
declaratorNames.add(_lowerCase);
QualifiedName _lowerCase_1 = this.nameConverter.toQualifiedName(type.getQualifiedName('.')).toLowerCase();
declaratorNames.add(_lowerCase_1);
}
}
};
targetURIs.getEObjectURIs(uri).forEach(_function_2);
_xblockexpression = null;
}
return _xblockexpression;
};
resourceAccess.<Object>readOnly(uri, _function_1);
};
targetURIs.getTargetResourceURIs().forEach(_function);
Declarators.DeclaratorsData _declaratorsData = new Declarators.DeclaratorsData(declaratorNames);
result = _declaratorsData;
targetURIs.<Declarators.DeclaratorsData>putUserData(Declarators.KEY, result);
return result;
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class OperatorDeclarationTest method testOperatorDeclaration_genericReturnTypeWithFunctionType_02.
@Test
public void testOperatorDeclaration_genericReturnTypeWithFunctionType_02() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
{
Set<QualifiedName> _operators = this.operatorMapping.getOperators();
for (final QualifiedName op : _operators) {
_builder.append("\t");
_builder.append("def Iterable< =>void> ");
_builder.append(op, "\t");
_builder.append("() { return null }");
_builder.newLineIfNotEmpty();
}
}
_builder.append("}");
_builder.newLine();
final XtendFile file = this._parseHelper.parse(_builder);
Assert.assertTrue(IterableExtensions.join(file.eResource().getErrors(), "\n"), file.eResource().getErrors().isEmpty());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class OperatorDeclarationTest method testOperatorDeclaration_genericReturnType.
@Test
public void testOperatorDeclaration_genericReturnType() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
{
Set<QualifiedName> _operators = this.operatorMapping.getOperators();
for (final QualifiedName op : _operators) {
_builder.append("\t");
_builder.append("def Iterable<String> ");
_builder.append(op, "\t");
_builder.append("() { return null }");
_builder.newLineIfNotEmpty();
}
}
_builder.append("}");
_builder.newLine();
final XtendFile file = this._parseHelper.parse(_builder);
Assert.assertTrue(IterableExtensions.join(file.eResource().getErrors(), "\n"), file.eResource().getErrors().isEmpty());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class XtendLabelProvider method text.
protected StyledString text(final XtendFunction element) {
final String simpleName = element.getName();
if ((simpleName != null)) {
final QualifiedName qnName = QualifiedName.create(simpleName);
final QualifiedName operator = this.operatorMapping.getOperator(qnName);
if ((operator != null)) {
final StyledString result = this.signature(operator.getFirstSegment(), this._iXtendJvmAssociations.getDirectlyInferredOperation(element));
result.append(((" (" + simpleName) + ")"), StyledString.COUNTER_STYLER);
return result;
}
}
return this.signature(element.getName(), this._iXtendJvmAssociations.getDirectlyInferredOperation(element));
}
Aggregations