Java Code Examples for org.eclipse.xtext.naming.QualifiedName

The following examples show how to use org.eclipse.xtext.naming.QualifiedName. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * Returns the mapped values of all nodes starting with the node for {@code lower} and up to (in depth-first search order) but excluding {@code upper}.
 *
 * @param lower
 *          name of first node to visit, must not be {@code null}
 * @param lowerIdx
 *          index into {@code lower} used for recursion, initially 0 (when receiver is root node)
 * @param upper
 *          marker node to know when to stop search (not given to visitor), must not be {@code null}
 * @param recursive
 *          whether to return {@link QualifiedNamePattern#isRecursivePattern() recursive matches} or not
 * @param excludeDuplicates
 *          whether duplicate values should be excluded in the result
 * @return collection of all values mapped by the nodes in the given range, never {@code null}
 */
@SuppressWarnings("unchecked")
public <T> Collection<T> matches(final QualifiedName lower, final int lowerIdx, final SegmentNode upper, final boolean recursive, final boolean excludeDuplicates) {
  final Collection<T> result = excludeDuplicates ? Sets.<T> newHashSet() : Lists.<T> newArrayList();
  Visitor visitor = new Visitor() {
    @Override
    public void visit(final SegmentNode node) {
      if (node.values != null) {
        for (Object value : node.values) {
          result.add((T) value);
        }
      }
    }
  };
  collectMatches(lower, lowerIdx, upper, recursive, visitor);
  return result;
}
 
Example 2
@Override
public void updateReference(ITextRegionDiffBuilder rewriter, IUpdatableReference ref) {
	if (rewriter.isModified(ref.getReferenceRegion())) {
		return;
	}
	IScope scope = scopeProvider.getScope(ref.getSourceEObject(), ref.getEReference());
	ISemanticRegion region = ref.getReferenceRegion();
	QualifiedName oldName = nameConverter.toQualifiedName(region.getText());
	IEObjectDescription oldDesc = scope.getSingleElement(oldName);
	if (oldDesc != null && oldDesc.getEObjectOrProxy() == ref.getTargetEObject()) {
		return;
	}
	String newName = findValidName(ref, scope);
	if (newName != null) {
		if (oldName.getSegmentCount() > 1) {
			newName = oldName.skipLast(1).append(newName).toString();
		}
		rewriter.replace(region, newName);
	}
}
 
Example 3
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case BuilderStatePackage.EOBJECT_DESCRIPTION__ECLASS:
			setEClass((EClass)newValue);
			return;
		case BuilderStatePackage.EOBJECT_DESCRIPTION__NAME:
			setName((QualifiedName)newValue);
			return;
		case BuilderStatePackage.EOBJECT_DESCRIPTION__FRAGMENT:
			setFragment((String)newValue);
			return;
		case BuilderStatePackage.EOBJECT_DESCRIPTION__USER_DATA:
			((EStructuralFeature.Setting)getUserData()).set(newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example 4
Source Project: sarl   Source File: SARLValidator.java    License: Apache License 2.0 6 votes vote down vote up
/** Check if the given action has a valid name.
 *
 * @param action the action to test.
 * @see SARLFeatureNameValidator
 */
@Check(CheckType.FAST)
public void checkActionName(SarlAction action) {
	final JvmOperation inferredOperation = this.associations.getDirectlyInferredOperation(action);
	final QualifiedName name = QualifiedName.create(inferredOperation.getQualifiedName('.').split("\\.")); //$NON-NLS-1$
	if (isReallyDisallowedName(name)) {
		final String validName = Utils.fixHiddenMember(action.getName());
		error(MessageFormat.format(
				Messages.SARLValidator_39,
				action.getName()),
				action,
				XTEND_FUNCTION__NAME,
				ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
				INVALID_MEMBER_NAME,
				validName);
	} else if (!isIgnored(DISCOURAGED_FUNCTION_NAME)
			&& this.featureNames_.isDiscouragedName(name)) {
		warning(MessageFormat.format(
				Messages.SARLValidator_39,
				action.getName()),
				action,
				XTEND_FUNCTION__NAME,
				ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
				DISCOURAGED_FUNCTION_NAME);
	}
}
 
Example 5
@Override
public IResourceDescription getResourceDescription(final URI uri) {
	return new AbstractResourceDescription() {

		@Override
		public Iterable<QualifiedName> getImportedNames() {
			return Collections.emptyList();
		}

		@Override
		public Iterable<IReferenceDescription> getReferenceDescriptions() {
			return Collections.emptyList();
		}

		@Override
		public URI getURI() {
			return uri;
		}

		@Override
		protected List<IEObjectDescription> computeExportedObjects() {
			return Collections.singletonList(EObjectDescription.create(exportedName, EcoreFactory.eINSTANCE.createEObject()));
		}
		
	};
}
 
Example 6
@Override
public Iterable<IEObjectDescription> getExportedObjects(final EClass type, final QualifiedName name, final boolean ignoreCase) {
  QualifiedName lowerCase = name.toLowerCase(); // NOPMD UseLocaleWithCaseConversions not a String!
  QualifiedNameLookup<IEObjectDescription> lookup = getNameToObjectsLookup();
  Collection<IEObjectDescription> values;
  final boolean isPattern = lowerCase instanceof QualifiedNamePattern;
  if (isPattern) {
    values = lookup.get((QualifiedNamePattern) lowerCase, false);
  } else {
    values = lookup.get(lowerCase);
  }
  if (values == null) {
    return Collections.emptyList();
  }
  Predicate<IEObjectDescription> predicate = ignoreCase ? input -> EcoreUtil2.isAssignableFrom(type, input.getEClass())
      : input -> isPattern ? EcoreUtil2.isAssignableFrom(type, input.getEClass()) && ((QualifiedNamePattern) name).matches(name)
          : name.equals(input.getName()) && EcoreUtil2.isAssignableFrom(type, input.getEClass());
  return Collections2.filter(values, predicate);
}
 
Example 7
Source Project: n4js   Source File: OpenTypeSelectionDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
protected Comparator getItemsComparator() {
	return Ordering.natural().nullsLast().from(new Comparator() {

		@Override
		public int compare(final Object o1, final Object o2) {
			if (o1 instanceof IEObjectDescription && o2 instanceof IEObjectDescription) {
				final IEObjectDescription d1 = (IEObjectDescription) o1;
				final IEObjectDescription d2 = (IEObjectDescription) o2;
				final QualifiedName fqn1 = d1.getQualifiedName();
				final QualifiedName fqn2 = d2.getQualifiedName();
				if (null != fqn1 && null != fqn2) {
					return nullToEmpty(fqn1.getLastSegment()).compareToIgnoreCase(
							nullToEmpty(fqn2.getLastSegment()));
				}
			}
			return Objects.hashCode(o1) - Objects.hashCode(o2);
		}
	});
}
 
Example 8
/**
 * Find and returns duplicate objects from a candidate list (iterable).
 *
 * @param possiblyDuplicateObjects
 *          an Iterable into which to look for duplicates
 * @return a set of duplicate objects
 */
public Set<T> findDuplicates(final Iterable<T> possiblyDuplicateObjects) {
  if (possiblyDuplicateObjects == null) {
    return Collections.emptySet();
  }

  final Map<QualifiedName, T> nameToEObjectMap = Maps.newHashMap();
  final Set<T> duplicateEObjects = Sets.newHashSet();

  for (final T object : possiblyDuplicateObjects) {
    if (object.eIsProxy()) {
      continue;
    }
    final QualifiedName name = nameFunction.apply(object);
    if (name == null) {
      continue;
    }
    T oldObject = nameToEObjectMap.put(name, object);
    if (oldObject != null) {
      // Register both EObjects with name
      duplicateEObjects.add(object);
      duplicateEObjects.add(oldObject);
    }
  }
  return duplicateEObjects;
}
 
Example 9
@Test public void testOneElement_Match() {
	QualifiedName qualifiedName = QualifiedName.create("SomeName");
	EClass type = EcorePackage.Literals.EPACKAGE;
	Resource resource = createResource();
	ENamedElement element = createNamedElement(qualifiedName, type, resource);
	Iterable<IEObjectDescription> iterable = container.getExportedObjectsByType(EcorePackage.Literals.EPACKAGE);
	assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
	iterable = container.getExportedObjectsByType(EcorePackage.Literals.EOBJECT);
	assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
	iterable = container.getExportedObjects(EcorePackage.Literals.EPACKAGE, qualifiedName, false);
	assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
	iterable = container.getExportedObjects(EcorePackage.Literals.ENAMED_ELEMENT, qualifiedName, false);
	assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
	iterable = container.getExportedObjects(EcorePackage.Literals.EOBJECT, qualifiedName, false);
	assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
}
 
Example 10
Source Project: xtext-extras   Source File: SyntaxFilteredScope.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("serial")
public SyntaxFilteredScope(IScope parent, List<String> values) {
	this.parent = parent;
	this.values = new HashSet<QualifiedName>() {
		@Override
		public boolean contains(Object o) {
			if (o instanceof IEObjectDescription) {
				return super.contains(((IEObjectDescription) o).getName());
			}
			return super.contains(o);
		}
	};
	for(String value: values) {
		this.values.add(QualifiedName.create(value));
	}
}
 
Example 11
Source Project: n4js   Source File: ImportRewriter.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings({ "unused", "deprecation" })
private AliasLocation enhanceExistingImportDeclaration(ImportDeclaration importDeclaration,
		QualifiedName qualifiedName,
		String optionalAlias, MultiTextEdit result) {

	addImportSpecifier(importDeclaration, qualifiedName, optionalAlias);
	ICompositeNode replaceMe = NodeModelUtils.getNode(importDeclaration);
	int offset = replaceMe.getOffset();
	AliasLocationAwareBuffer observableBuffer = new AliasLocationAwareBuffer(
			optionalAlias,
			offset,
			grammarAccess);

	try {
		serializer.serialize(
				importDeclaration,
				observableBuffer,
				SaveOptions.newBuilder().noValidation().getOptions());
	} catch (IOException e) {
		throw new RuntimeException("Should never happen since we write into memory", e);
	}
	result.addChild(new ReplaceEdit(offset, replaceMe.getLength(), observableBuffer.toString()));
	return observableBuffer.getAliasLocation();
}
 
Example 12
/** In case of main module, adjust the qualified name, e.g. index.Element -> react.Element */
private QualifiedName getCandidateName(IEObjectDescription candidate, String tmodule) {
	QualifiedName candidateName;
	IN4JSProject project = n4jsCore.findProject(candidate.getEObjectURI()).orNull();
	if (project != null && tmodule != null && tmodule.equals(project.getMainModule())) {
		N4JSProjectName projectName = project.getProjectName();
		N4JSProjectName definesPackage = project.getDefinesPackageName();
		if (definesPackage != null) {
			projectName = definesPackage;
		}
		String lastSegmentOfQFN = candidate.getQualifiedName().getLastSegment().toString();
		candidateName = QualifiedName.create(projectName.getRawName(), lastSegmentOfQFN);
	} else {
		candidateName = candidate.getQualifiedName();
	}
	return candidateName;
}
 
Example 13
@Override
public QualifiedName getFullyQualifiedName(final EObject obj) {
	return cache.get(Tuples.pair(obj, getCacheKey()), obj.eResource(), new Provider<QualifiedName>() {

		@Override
		public QualifiedName get() {
			EObject temp = obj;
			String name = nameDispatcher.invoke(temp);
			if (Strings.isEmpty(name))
				return null;
			QualifiedName qualifiedName = QualifiedName.create(name);
			if(!isRecurseParent(obj))
				return qualifiedName;
			QualifiedName parentsQualifiedName = getFullyQualifiedName(obj.eContainer());
			if (parentsQualifiedName == null)
				return null;
			else 
				return parentsQualifiedName.append(qualifiedName);
		}

	});
}
 
Example 14
Source Project: xtext-core   Source File: ImportScopeTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testImports_01() throws Exception {
	final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EANNOTATION);
	final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE);
	SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
	ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("com"), true, false);
	ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("de","foo"), false, false);
	TestableImportScope scope = new TestableImportScope(newArrayList(n1,n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, false);
	
	final Iterable<IEObjectDescription> elements = scope.getAllElements();
	Iterator<IEObjectDescription> iterator = elements.iterator();
	assertEquals("foo.bar", iterator.next().getName().toString());
	assertEquals("foo", iterator.next().getName().toString());
	assertSame(desc1,iterator.next());
	assertSame(desc2,iterator.next());
	assertFalse(iterator.hasNext());
}
 
Example 15
Source Project: xtext-eclipse   Source File: NewFeatureNameUtil.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public String getDefaultName(XExpression expression) {
	String baseName = getBaseName(expression);
	final List<String> candidates = newArrayList();
	Set<String> excludedNames = new HashSet<String>(allKeywords); 
	for(IEObjectDescription featureDescription: featureCallScope.getAllElements()) {
		QualifiedName featureQName = featureDescription.getQualifiedName();
		if(featureQName.getSegmentCount() == 1)
			excludedNames.add(featureQName.getLastSegment());
	}
	jdtVariableCompletions.getVariableProposals(baseName, expression, VariableType.LOCAL_VAR, excludedNames, new CompletionDataAcceptor() {
		@Override
		public void accept(String replaceText, StyledString label, Image img) {
			candidates.add(replaceText);
		}
	});
	return candidates.isEmpty() ? "dingenskirchen" : candidates.get(0);
}
 
Example 16
public ConstructorDescription(
		QualifiedName qualifiedName, 
		JvmConstructor constructor,
		int bucketId,
		boolean visible) {
	this(qualifiedName, constructor, bucketId, visible, false);
}
 
Example 17
Source Project: xtext-xtend   Source File: ImportedNamesTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testNestedTypesIncluded() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package foo");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val foo = types.StaticOuterClass.StaticMiddleClass.StaticInnerClass.CONSTANT");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    final XtendFile file = this.file(_builder.toString());
    final IResourceDescription description = this.resourceDescriptionManager.getResourceDescription(file.eResource());
    final Iterable<QualifiedName> importedNames = description.getImportedNames();
    final Function1<QualifiedName, Boolean> _function = (QualifiedName it) -> {
      String _string = it.toString();
      String _lowerCase = "types.StaticOuterClass$StaticMiddleClass$StaticInnerClass".toLowerCase();
      return Boolean.valueOf(Objects.equal(_string, _lowerCase));
    };
    Assert.assertTrue(("" + importedNames), IterableExtensions.<QualifiedName>exists(importedNames, _function));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 18
protected boolean isAffected(Collection<QualifiedName> importedNames, IResourceDescription description) {
	if (description != null) {
		for (IEObjectDescription desc : description.getExportedObjects())
			if (importedNames.contains(desc.getName().toLowerCase()))
				return true;
	}
	return false;
}
 
Example 19
public StaticFeatureDescription(QualifiedName qualifiedName, JvmFeature feature, int bucketId,
		boolean visible) {
	super(qualifiedName, feature, bucketId, visible);
	if (!feature.isStatic()) {
		throw new IllegalArgumentException(String.valueOf(feature));
	}
}
 
Example 20
Source Project: statecharts   Source File: StextNameProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public QualifiedName qualifiedName(InterfaceScope ele) {
	QualifiedName name = null;
	if (!Strings.isEmpty(ele.getName())) {
		name = nameConverter.toQualifiedName(ele.getName());
	}
	QualifiedName namespace = getNamespace(ele);
	if (namespace != null && name != null) {
		name = namespace.append(name);
	}
	return name;
}
 
Example 21
Source Project: n4js   Source File: N4TSQualifiedNameProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the matching (internal) name of the polyfill matching the given classifier. There are no polyfills of
 * polyfills, so the returned name is independent from the polyfill flag of the given classifier.
 */
public static QualifiedName getPolyfillFQN(TClassifier tClassifier, IQualifiedNameProvider qualifiedNameProvider) {
	QualifiedName prefix = qualifiedNameProvider.getFullyQualifiedName(EcoreUtil.getRootContainer(tClassifier));
	if ("n4ts".equals(tClassifier.eResource().getURI().fileExtension())) { // } instanceof TObjectPrototype) {
		prefix = append(prefix, GLOBAL_NAMESPACE_SEGMENT);
		// TODO this has to be removed, instead, also n4ts files should use "#" as global namespace segment
	}
	prefix = append(prefix, POLYFILL_SEGMENT);
	return append(prefix, tClassifier.getName());
}
 
Example 22
@Override
protected ConfigurableCompletionProposal.IReplacementTextApplier createTextApplier(final ContentAssistContext context, final IScope typeScope, final IQualifiedNameConverter qualifiedNameConverter, final IValueConverter<String> valueConverter) {
  final Predicate<IEObjectDescription> _function = (IEObjectDescription it) -> {
    QualifiedName _name = it.getName();
    return (!Objects.equal(_name, XtendImportedNamespaceScopeProvider.OLD_DATA_ANNOTATION));
  };
  final FilteringScope scope = new FilteringScope(typeScope, _function);
  return super.createTextApplier(context, scope, qualifiedNameConverter, valueConverter);
}
 
Example 23
@Override
public void completeXMemberFeatureCall_Feature(EObject model, Assignment assignment, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if (model instanceof XMemberFeatureCall) {
		XExpression memberCallTarget = ((XMemberFeatureCall) model).getMemberCallTarget();
		IResolvedTypes resolvedTypes = typeResolver.resolveTypes(memberCallTarget);
		LightweightTypeReference memberCallTargetType = resolvedTypes.getActualType(memberCallTarget);
		Iterable<JvmFeature> featuresToImport = getFavoriteStaticFeatures(model, input -> {
			if(input instanceof JvmOperation && input.isStatic()) {
				List<JvmFormalParameter> parameters = ((JvmOperation) input).getParameters();
				if(parameters.size() > 0) {
					JvmFormalParameter firstParam = parameters.get(0);
					JvmTypeReference parameterType = firstParam.getParameterType();
					if(parameterType != null) {
						LightweightTypeReference lightweightTypeReference = memberCallTargetType.getOwner().toLightweightTypeReference(parameterType);
						if(lightweightTypeReference != null) {
							return memberCallTargetType.isAssignableFrom(lightweightTypeReference);
						}
					}
				}
			}
			return false;
		});
		// Create StaticExtensionFeatureDescriptionWithImplicitFirstArgument instead of SimpleIdentifiableElementDescription since we want the Proposal to show parameters
		Iterable<IEObjectDescription> scopedFeatures = Iterables.transform(featuresToImport, feature -> {
			QualifiedName qualifiedName = QualifiedName.create(feature.getSimpleName());
			return new StaticExtensionFeatureDescriptionWithImplicitFirstArgument(qualifiedName, feature, memberCallTarget, memberCallTargetType, 0, true);
		});
		// Scope for all static features
		IScope staticMemberScope = new SimpleScope(IScope.NULLSCOPE, scopedFeatures);
		proposeFavoriteStaticFeatures(model, context, acceptor, staticMemberScope);
		// Regular proposals
		createReceiverProposals(((XMemberFeatureCall) model).getMemberCallTarget(), (CrossReference) assignment.getTerminal(),
				context, acceptor);
	} else if (model instanceof XAssignment) {
		createReceiverProposals(((XAssignment) model).getAssignable(), (CrossReference) assignment.getTerminal(),
				context, acceptor);
	}
}
 
Example 24
protected BucketedEObjectDescription createExtensionDescription(QualifiedName name, JvmFeature feature, XExpression receiver, LightweightTypeReference receiverType,
		Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> receiverTypeParameterMapping, ExpressionBucket bucket, boolean validStaticState) {
	if (helper == null || !helper.isPossibleExtension(feature)) {
		return null;
	}
	return doCreateExtensionDescription(name, feature, receiver, receiverType, receiverTypeParameterMapping, bucket, validStaticState);
}
 
Example 25
Source Project: xtext-xtend   Source File: TypeLookupImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private Type findTypeOnScope(final String typeName, final Function1<? super IEObjectDescription, ? extends Boolean> filter) {
  final QualifiedName qualifiedName = this.compilationUnit.getQualifiedNameConverter().toQualifiedName(typeName);
  final IEObjectDescription result = this.compilationUnit.getScopeProvider().getScope(this.compilationUnit.getXtendFile(), XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE).getSingleElement(qualifiedName);
  if ((((result != null) && TypesPackage.Literals.JVM_TYPE.isSuperTypeOf(result.getEClass())) && (filter.apply(result)).booleanValue())) {
    EObject _eObjectOrProxy = result.getEObjectOrProxy();
    return this.compilationUnit.toType(((JvmType) _eObjectOrProxy));
  }
  return null;
}
 
Example 26
@Override
public IEObjectDescription getLocalElement(QualifiedName name) {
	JvmIdentifiableElement result = map.get(name);
	if (result != null)
		return EObjectDescription.create(name, result);
	return super.getLocalElement(name);
}
 
Example 27
/**
 * Create EObjectDescriptions for variables for which N4JSQualifiedNameProvider provides a FQN; variables with a FQN
 * of <code>null</code> (currently all non-exported variables) will be ignored.
 */
private void internalCreateEObjectDescription(TVariable variable, IAcceptor<IEObjectDescription> acceptor) {
	QualifiedName qualifiedName = qualifiedNameProvider.getFullyQualifiedName(variable);
	if (qualifiedName != null) { // e.g. non-exported variables will return null for FQN
		Map<String, String> userData = new HashMap<>();
		addAccessModifierUserData(userData, variable.getTypeAccessModifier());
		addConstUserData(userData, variable);

		IEObjectDescription eod = EObjectDescription.create(qualifiedName, variable, userData);
		acceptor.accept(eod);
	}
}
 
Example 28
Source Project: xtext-extras   Source File: ExpressionScopeTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void assertContains(IScope scope, QualifiedName name) {
	Iterable<IEObjectDescription> elements = scope.getAllElements();
	String toString = elements.toString();
	assertNotNull(toString, scope.getSingleElement(name));
	assertFalse(toString, Iterables.isEmpty(scope.getElements(name)));
	assertTrue(toString, IterableExtensions.exists(elements, it -> Objects.equal(it.getName(), name)));
}
 
Example 29
/**
 * Qualified name for FormatConfiguration.
 *
 * @param element
 *          the FormatConfiguration
 * @return the qualified name
 */
public QualifiedName qualifiedName(final FormatConfiguration element) {
  if (element.eResource() != null && element.eResource().getURI() != null) {
    StringBuilder grammarNameBuilder = new StringBuilder();
    for (INode node : NodeModelUtils.findNodesForFeature(element, FormatPackage.Literals.FORMAT_CONFIGURATION__TARGET_GRAMMAR)) {
      grammarNameBuilder.append(NodeModelUtils.getTokenText(node));
    }
    return getConverter().toQualifiedName(grammarNameBuilder.toString());
  }
  return null;
}
 
Example 30
public SuperConstructorDescription(
		QualifiedName qualifiedName, 
		JvmConstructor constructor,
		Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> typeParameterMapping,
		int bucketId, 
		boolean visible) {
	super(qualifiedName, constructor, bucketId, visible);
	this.typeParameterMapping = typeParameterMapping;
}