org.eclipse.xtext.xbase.typesystem.override.IResolvedField Java Examples

The following examples show how to use org.eclipse.xtext.xbase.typesystem.override.IResolvedField. 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: XbaseLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @return the {@code ImageDescriptor} for a given {@code obj}
 * @throws NullPointerException
 *             if the passed {@code obj} is null
 */
protected ImageDescriptor imageDescriptor(Object obj) {
	Preconditions.checkNotNull(obj);

	if (obj instanceof JvmConstructor) {
		return _imageDescriptor((JvmConstructor) obj);
	} else if (obj instanceof JvmOperation) {
		return _imageDescriptor((JvmOperation) obj);
	} else if (obj instanceof JvmAnnotationType) {
		return _imageDescriptor((JvmAnnotationType) obj);
	} else if (obj instanceof JvmEnumerationType) {
		return _imageDescriptor((JvmEnumerationType) obj);
	} else if (obj instanceof JvmField) {
		return _imageDescriptor((JvmField) obj);
	} else if (obj instanceof JvmGenericType) {
		return _imageDescriptor((JvmGenericType) obj);
	} else if (obj instanceof JvmTypeParameter) {
		return _imageDescriptor((JvmTypeParameter) obj);
	} else if (obj instanceof JvmFormalParameter) {
		return _imageDescriptor((JvmFormalParameter) obj);
	} else if (obj instanceof XVariableDeclaration) {
		return _imageDescriptor((XVariableDeclaration) obj);
	} else if (obj instanceof IResolvedConstructor) {
		return _imageDescriptor((IResolvedConstructor) obj);
	} else if (obj instanceof IResolvedOperation) {
		return _imageDescriptor((IResolvedOperation) obj);
	} else if (obj instanceof XImportDeclaration) {
		return _imageDescriptor((XImportDeclaration) obj);
	} else if (obj instanceof XImportSection) {
		return _imageDescriptor((XImportSection) obj);
	} else if (obj instanceof IResolvedField) {
		return _imageDescriptor((IResolvedField) obj);
	}
	return _imageDescriptor(obj);
}
 
Example #2
Source File: XbaseLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ImageDescriptor _imageDescriptor(IResolvedField field) {
	return _imageDescriptor(field.getDeclaration());
}
 
Example #3
Source File: XbaseLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected Object text(IResolvedField field) {
	return new StyledString(field.getSimpleSignature() + " : " + field.getResolvedType().getHumanReadableName());
}
 
Example #4
Source File: XtendLabelProvider.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ImageDescriptor imageDescriptor(final Object operation) {
  if (operation instanceof JvmConstructor) {
    return _imageDescriptor((JvmConstructor)operation);
  } else if (operation instanceof JvmOperation) {
    return _imageDescriptor((JvmOperation)operation);
  } else if (operation instanceof JvmAnnotationType) {
    return _imageDescriptor((JvmAnnotationType)operation);
  } else if (operation instanceof JvmEnumerationType) {
    return _imageDescriptor((JvmEnumerationType)operation);
  } else if (operation instanceof JvmField) {
    return _imageDescriptor((JvmField)operation);
  } else if (operation instanceof JvmGenericType) {
    return _imageDescriptor((JvmGenericType)operation);
  } else if (operation instanceof AnonymousClass) {
    return _imageDescriptor((AnonymousClass)operation);
  } else if (operation instanceof XtendAnnotationType) {
    return _imageDescriptor((XtendAnnotationType)operation);
  } else if (operation instanceof XtendClass) {
    return _imageDescriptor((XtendClass)operation);
  } else if (operation instanceof XtendConstructor) {
    return _imageDescriptor((XtendConstructor)operation);
  } else if (operation instanceof XtendEnum) {
    return _imageDescriptor((XtendEnum)operation);
  } else if (operation instanceof XtendFunction) {
    return _imageDescriptor((XtendFunction)operation);
  } else if (operation instanceof XtendInterface) {
    return _imageDescriptor((XtendInterface)operation);
  } else if (operation instanceof JvmTypeParameter) {
    return _imageDescriptor((JvmTypeParameter)operation);
  } else if (operation instanceof XtendEnumLiteral) {
    return _imageDescriptor((XtendEnumLiteral)operation);
  } else if (operation instanceof XtendField) {
    return _imageDescriptor((XtendField)operation);
  } else if (operation instanceof JvmFormalParameter) {
    return _imageDescriptor((JvmFormalParameter)operation);
  } else if (operation instanceof XVariableDeclaration) {
    return _imageDescriptor((XVariableDeclaration)operation);
  } else if (operation instanceof XtendFile) {
    return _imageDescriptor((XtendFile)operation);
  } else if (operation instanceof IResolvedConstructor) {
    return _imageDescriptor((IResolvedConstructor)operation);
  } else if (operation instanceof IResolvedOperation) {
    return _imageDescriptor((IResolvedOperation)operation);
  } else if (operation instanceof XImportDeclaration) {
    return _imageDescriptor((XImportDeclaration)operation);
  } else if (operation instanceof XImportSection) {
    return _imageDescriptor((XImportSection)operation);
  } else if (operation instanceof IResolvedField) {
    return _imageDescriptor((IResolvedField)operation);
  } else if (operation != null) {
    return _imageDescriptor(operation);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(operation).toString());
  }
}
 
Example #5
Source File: AbstractXtendOutlineTreeBuilder.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void buildInheritedMembers(final JvmDeclaredType inferredType, final IXtendOutlineContext context) {
  ResourceSet _resourceSet = inferredType.eResource().getResourceSet();
  final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, _resourceSet);
  final LightweightTypeReference typeReference = owner.toLightweightTypeReference(inferredType);
  final List<LightweightTypeReference> superTypes = typeReference.getAllSuperTypes();
  IXtendOutlineContext superTypeContext = context;
  for (final LightweightTypeReference superTypeRef : superTypes) {
    {
      superTypeContext = superTypeContext.increaseInheritanceDepth();
      final ResolvedFeatures resolvedFeatures = new ResolvedFeatures(superTypeRef);
      List<IResolvedField> _declaredFields = resolvedFeatures.getDeclaredFields();
      for (final IResolvedField jvmField : _declaredFields) {
        boolean _skipFeature = this.skipFeature(jvmField.getDeclaration());
        boolean _not = (!_skipFeature);
        if (_not) {
          this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, jvmField, superTypeContext);
        }
      }
      List<IResolvedConstructor> _declaredConstructors = resolvedFeatures.getDeclaredConstructors();
      for (final IResolvedConstructor constructor : _declaredConstructors) {
        boolean _skipFeature_1 = this.skipFeature(constructor.getDeclaration());
        boolean _not_1 = (!_skipFeature_1);
        if (_not_1) {
          this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, constructor, superTypeContext);
        }
      }
      List<IResolvedOperation> _declaredOperations = resolvedFeatures.getDeclaredOperations();
      for (final IResolvedOperation operation : _declaredOperations) {
        if (((!this.skipFeature(operation.getDeclaration())) && (!superTypeContext.isProcessed(operation.getDeclaration())))) {
          this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, operation, superTypeContext);
        }
      }
      final JvmType declaredType = superTypeRef.getType();
      if ((declaredType instanceof JvmDeclaredType)) {
        final IXtendOutlineContext nestedTypeContext = superTypeContext.hideInherited();
        final Consumer<JvmDeclaredType> _function = (JvmDeclaredType it) -> {
          this.buildJvmType(it, nestedTypeContext);
        };
        Iterables.<JvmDeclaredType>filter(((JvmDeclaredType)declaredType).getMembers(), JvmDeclaredType.class).forEach(_function);
      }
    }
  }
}