Java Code Examples for org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator

The following are top voted examples for showing how to use org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: xtext-extras   File: XbaseUsageCrossReferencer.java   View source code 6 votes vote down vote up
@Override
protected TreeIterator<Notifier> newContentsIterator() {
	return new ContentTreeIterator<Notifier>(emfObjects) {
		private static final long serialVersionUID = 1L;

		@Override
		protected Iterator<? extends EObject> getEObjectChildren(EObject eObject) {
			if(eObject instanceof XAbstractFeatureCall){
				Iterable<EObject> result = eObject.eContents();
				XAbstractFeatureCall featureCall = (XAbstractFeatureCall) eObject;
				XExpression implicitReceiver = featureCall.getImplicitReceiver();
				if(implicitReceiver != null) 
					result = Iterables.concat(result, Collections.singleton(implicitReceiver));
				XExpression implicitFirstArgument = featureCall.getImplicitFirstArgument();
				if(implicitFirstArgument != null)
					result = Iterables.concat(result, Collections.singleton(implicitFirstArgument));
				return result.iterator();
			} else 
				return super.getEObjectChildren(eObject);
		}
	};
}
 
Example 2
Project: eclipse-avro   File: ResourceImpl.java   View source code 6 votes vote down vote up
protected TreeIterator<EObject> getAllProperContents(List<EObject> contents)
{
  return
    new ContentTreeIterator<EObject>(contents, false)
    {
      private static final long serialVersionUID = 1L;

      @SuppressWarnings("unchecked")
      @Override
      public Iterator<EObject> getChildren(Object object)
      {
        return
          object == this.object ?
            ((List<EObject>)object).iterator() :
            new ProperContentIterator<EObject>(((EObject)object));
      }
    };
}
 
Example 3
Project: clickwatch   File: ResourceImpl.java   View source code 6 votes vote down vote up
protected TreeIterator<EObject> getAllProperContents(List<EObject> contents)
{
  return
    new ContentTreeIterator<EObject>(contents, false)
    {
      private static final long serialVersionUID = 1L;

      @SuppressWarnings("unchecked")
      @Override
      public Iterator<EObject> getChildren(Object object)
      {
        return
          object == this.object ?
            ((List<EObject>)object).iterator() :
            new ProperContentIterator<EObject>(((EObject)object));
      }
    };
}