org.eclipse.xtext.common.types.JvmUnknownTypeReference Java Examples

The following examples show how to use org.eclipse.xtext.common.types.JvmUnknownTypeReference. 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 check out the related API usage on the sidebar.
Example #1
Source File: UnknownTypeReference.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public JvmTypeReference toTypeReference() {
	JvmUnknownTypeReference result = getTypesFactory().createJvmUnknownTypeReference();
	if (name != null)
		result.setQualifiedName(name);
	return result;
}
 
Example #2
Source File: JvmTypesBuilder.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a clone of the given {@link JvmTypeReference} without resolving any proxies.
 * The clone will be associated with the original element by means of {@link JvmModelAssociator associations}.
 * 
 * @param typeRef the type reference to be cloned.
 * @return a clone of typeRef, <code>null</code> if typeRef is <code>null</code> or a {@link JvmUnknownTypeReference} 
 *     if there is a problem with the typeRef. 
 */
/* @Nullable */ 
public JvmTypeReference cloneWithProxies(/* @Nullable */ JvmTypeReference typeRef) {
	if(typeRef == null)
		return null;
	if (typeRef instanceof JvmParameterizedTypeReference && !typeRef.eIsProxy()
			&& !typeRef.eIsSet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE)) {
		JvmUnknownTypeReference unknownTypeReference = typesFactory.createJvmUnknownTypeReference();
		return unknownTypeReference;
	}
	return cloneAndAssociate(typeRef);
}
 
Example #3
Source File: JvmUnknownTypeReferenceItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String getText(Object object)
{
	String label = ((JvmUnknownTypeReference)object).getQualifiedName();
	return label == null || label.length() == 0 ?
		getString("_UI_JvmUnknownTypeReference_type") :
		getString("_UI_JvmUnknownTypeReference_type") + " " + label;
}
 
Example #4
Source File: JvmUnknownTypeReferenceItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This handles model notifications by calling {@link #updateChildren} to update any cached
 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void notifyChanged(Notification notification)
{
	updateChildren(notification);

	switch (notification.getFeatureID(JvmUnknownTypeReference.class))
	{
		case TypesPackage.JVM_UNKNOWN_TYPE_REFERENCE__QUALIFIED_NAME:
			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
			return;
	}
	super.notifyChanged(notification);
}
 
Example #5
Source File: AbstractCodeBuilder.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected String getIdentifierOrObject(final JvmTypeReference typeReference) {
  String _switchResult = null;
  boolean _matched = false;
  if (typeReference instanceof JvmUnknownTypeReference) {
    _matched=true;
    _switchResult = "java.lang.Object";
  }
  if (!_matched) {
    _switchResult = typeReference.getIdentifier();
  }
  return _switchResult;
}
 
Example #6
Source File: SARLJvmModelInferrer.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Generate the extended types for the given SARL statement.
 *
 * @param context the context of the generation.
 * @param owner the JVM element to change.
 * @param defaultJvmType the default JVM type.
 * @param defaultSarlType the default Sarl type.
 * @param supertypes the supertypes.
 */
protected void appendConstrainedExtends(
		GenerationContext context,
		JvmGenericType owner, Class<?> defaultJvmType, Class<? extends XtendTypeDeclaration> defaultSarlType,
		List<? extends JvmParameterizedTypeReference> supertypes) {
	boolean explicitType = false;
	final String ownerId = owner.getIdentifier();
	for (final JvmParameterizedTypeReference superType : supertypes) {
		String superTypeId;
		try {
			superTypeId = superType.getIdentifier();
		} catch (Exception ex) {
			logInternalError(ex);
			superTypeId = null;
		}
		if (!Objects.equal(ownerId, superTypeId)
				&& superType.getType() instanceof JvmGenericType
				/*&& this.inheritanceHelper.isProxyOrSubTypeOf(superType, defaultJvmType, defaultSarlType, isInterface)*/) {
			owner.getSuperTypes().add(this.typeBuilder.cloneWithProxies(superType));
			context.incrementSerial(superType.getIdentifier().hashCode());
			explicitType = true;
		}
	}
	if (!explicitType) {
		final JvmTypeReference type = this._typeReferenceBuilder.typeRef(defaultJvmType);
		if (!(type instanceof JvmUnknownTypeReference)) {
			owner.getSuperTypes().add(type);
		}
		context.incrementSerial(type.getIdentifier().hashCode());
	}
}
 
Example #7
Source File: ProxyAwareUIStrings.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public StringBuilder doVisitUnknownTypeReference(JvmUnknownTypeReference reference, StringBuilder param) {
	return doVisitTypeReference(reference, param);
}
 
Example #8
Source File: LightweightTypeReferenceFactory.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public LightweightTypeReference doVisitUnknownTypeReference(JvmUnknownTypeReference reference) {
	if (reference.eIsSet(TypesPackage.Literals.JVM_UNKNOWN_TYPE_REFERENCE__QUALIFIED_NAME))
		return owner.newUnknownTypeReference(reference.getQualifiedName());
	return owner.newUnknownTypeReference();
}
 
Example #9
Source File: JvmTypeReferenceBuilder.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
private JvmTypeReference createUnknownTypeReference(String name) {
	JvmUnknownTypeReference reference = TypesFactory.eINSTANCE.createJvmUnknownTypeReference();
	reference.setQualifiedName(name);
	return reference;
}
 
Example #10
Source File: JvmTypeReferenceBuilderTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testTypeRef_05() {
	JvmTypeReference typeRef = typeReferenceBuilder.typeRef("hubble.Fubble", typeReferenceBuilder.typeRef(String.class));
	Assert.assertTrue(typeRef instanceof JvmUnknownTypeReference);
	Assert.assertEquals("hubble.Fubble", typeRef.getQualifiedName());
}
 
Example #11
Source File: AbstractTypeReferenceVisitor.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Result doVisitUnknownTypeReference(JvmUnknownTypeReference reference) {
	return doVisitTypeReference(reference);
}
 
Example #12
Source File: TypeReferences.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected JvmUnknownTypeReference getUnknownTypeReference(String qualifiedName) {
	JvmUnknownTypeReference reference = TypesFactory.eINSTANCE.createJvmUnknownTypeReference();
	reference.setQualifiedName(qualifiedName);
	return reference;
}
 
Example #13
Source File: AbstractTypeReferenceVisitorWithParameter.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Result doVisitUnknownTypeReference(JvmUnknownTypeReference reference, Parameter param) {
	return doVisitTypeReference(reference, param);
}
 
Example #14
Source File: ITypeReferenceVisitorWithParameter.java    From xtext-extras with Eclipse Public License 2.0 votes vote down vote up
Result doVisitUnknownTypeReference(JvmUnknownTypeReference reference, Parameter param); 
Example #15
Source File: ITypeReferenceVisitor.java    From xtext-extras with Eclipse Public License 2.0 votes vote down vote up
Result doVisitUnknownTypeReference(JvmUnknownTypeReference reference);