Java Code Examples for org.eclipse.emf.common.notify.impl.NotificationImpl

The following are top voted examples for showing how to use org.eclipse.emf.common.notify.impl.NotificationImpl. 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: n4js   File: N4JSResource.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a custom notification and sends it for proxy and loaded object. Registers adapters to loaded object.
 *
 * @param idx
 *            index in the contents list (first or second slot)
 * @param oldProxy
 *            the proxified object before being loaded
 */
protected void notifyProxyResolved(int idx, EObject oldProxy) {
	if (eNotificationRequired() && idx < contents.size()) {
		EObject newObject = contents.basicGet(idx);
		Notification notification = new NotificationImpl(Notification.RESOLVE, oldProxy, newObject) {
			@Override
			public Object getNotifier() {
				return N4JSResource.this;
			}

			@Override
			public int getFeatureID(Class<?> expectedClass) {
				return RESOURCE__CONTENTS;
			}
		};
		eNotify(notification);
		for (Adapter adapter : eAdapters()) {
			if (adapter instanceof EContentAdapter && !newObject.eAdapters().contains(adapter)) {
				newObject.eAdapters().add(adapter);
			}
		}
	}
}
 
Example 2
Project: statecharts   File: DerivedEObjectEList.java   Source Code and License 6 votes vote down vote up
@Override
public boolean addAllUnique(int index, Collection<? extends E> objects) {
	int size = objects.size();

	if (size > 0) {

		if (isNotificationRequired()) {
			boolean oldIsSet = isSet();

			if (doAddAllUnique(index, objects)) {
				NotificationImpl notification = size == 1 ? createNotification(
						Notification.ADD, null, objects.iterator().next(),
						index, oldIsSet) : createNotification(
						Notification.ADD_MANY, null, objects, index,
						oldIsSet);
				dispatchNotification(notification);
				return true;
			}
		} else {
			return doAddAllUnique(index, objects);
		}
	}

	return false;
}
 
Example 3
Project: statecharts   File: DerivedEObjectEList.java   Source Code and License 6 votes vote down vote up
@Override
public E remove(int index) {

	if (isNotificationRequired()) {
		boolean oldIsSet = isSet();
		NotificationImpl notification = createNotification(
				Notification.REMOVE, super.remove(index), null, index,
				oldIsSet);
		dispatchNotification(notification);
		@SuppressWarnings("unchecked")
		E oldValue = (E) notification.getOldValue();
		return oldValue;
	} else {
		return super.remove(index);
	}
}
 
Example 4
Project: OpenSPIFe   File: ProfileImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
@SuppressWarnings("unchecked")
public EList<DataPoint<T>> getDataPoints() {
	if (dataPoints == null) {
		dataPoints = new EDataTypeUniqueEList<DataPoint<T>>(DataPoint.class, this, JSciencePackage.PROFILE__DATA_POINTS) {

			@Override
			protected NotificationImpl createNotification(int eventType, boolean oldValue, boolean newValue) {
				return new TouchyNotification(owner, eventType, getFeatureID(), oldValue, newValue);
			}

			@Override
			protected NotificationImpl createNotification(int eventType, Object oldObject, Object newObject, int index, boolean wasSet) {
				return new TouchyNotification(owner, eventType, getFeatureID(), oldObject, newObject, index, wasSet);
			}

			@Override
			protected NotificationImpl createNotification(int eventType, Object oldObject, Object newObject, int index) {
				return new TouchyNotification(owner, eventType, getFeatureID(), oldObject, newObject, index);
			}

		};
	}
	return dataPoints;
}
 
Example 5
Project: eclipse-avro   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setURI(URI uri)
{
  URI oldURI = this.uri;
  this.uri = uri;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldURI, uri)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__URI;
        }
      };
    eNotify(notification);
  }
}
 
Example 6
Project: eclipse-avro   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setTimeStamp(long timeStamp)
{
  long oldTimeStamp = this.timeStamp;
  this.timeStamp = timeStamp;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldTimeStamp, timeStamp)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__TIME_STAMP;
        }
      };
    eNotify(notification);
  }
}
 
Example 7
Project: eclipse-avro   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setModified(boolean isModified)
{
  boolean oldIsModified = this.isModified;
  this.isModified = isModified;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldIsModified, isModified)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__IS_MODIFIED;
        }
      };
    eNotify(notification);
  }
}
 
Example 8
Project: clickwatch   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setURI(URI uri)
{
  URI oldURI = this.uri;
  this.uri = uri;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldURI, uri)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__URI;
        }
      };
    eNotify(notification);
  }
}
 
Example 9
Project: clickwatch   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setTimeStamp(long timeStamp)
{
  long oldTimeStamp = this.timeStamp;
  this.timeStamp = timeStamp;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldTimeStamp, timeStamp)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__TIME_STAMP;
        }
      };
    eNotify(notification);
  }
}
 
Example 10
Project: clickwatch   File: ResourceImpl.java   Source Code and License 6 votes vote down vote up
public void setModified(boolean isModified)
{
  boolean oldIsModified = this.isModified;
  this.isModified = isModified;
  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldIsModified, isModified)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__IS_MODIFIED;
        }
      };
    eNotify(notification);
  }
}
 
Example 11
Project: statecharts   File: DerivedEObjectEList.java   Source Code and License 5 votes vote down vote up
@Override
public void addUnique(int index, E object) {

	if (isNotificationRequired()) {
		boolean oldIsSet = isSet();
		super.add(index, validate(index, object));
		NotificationImpl notification = createNotification(
				Notification.ADD, null, object, index, oldIsSet);
		dispatchNotification(notification);
	} else {
		super.add(index, validate(index, object));
	}
}
 
Example 12
Project: eclipse-avro   File: ResourceImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the load state as indicated, and returns a notification, if {@link org.eclipse.emf.common.notify.impl.BasicNotifierImpl#eNotificationRequired required}.
 * Clients are <b>not</b> expected to call this directly; it is managed by the implementation.
 * @param isLoaded whether the resource is loaded.
 * @return a notification.
 */
protected Notification setLoaded(boolean isLoaded)
{
  boolean oldIsLoaded = this.isLoaded;
  this.isLoaded = isLoaded;

  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldIsLoaded, isLoaded)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__IS_LOADED;
        }
      };
    return notification;
  }
  else
  {
    return null;
  }
}
 
Example 13
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public Object resolveProxy(EStructuralFeature feature, int entryIndex, int index, Object object)
{
  EObject resolved = resolveProxy((EObject)object);
  if (resolved != object)
  {
    Entry oldObject = (Entry)data[entryIndex];
    Entry entry = createEntry(feature, resolved);
    assign(entryIndex, validate(entryIndex, entry));
    didSet(entryIndex, entry, oldObject);

    if (isNotificationRequired())
    {
      NotificationImpl notifications = 
        createNotification
          (Notification.RESOLVE, 
           entry.getEStructuralFeature(), 
           object,
           resolved,
           index,
           false);

      notifications.add(createNotification(Notification.RESOLVE, oldObject, entry, index, false));
      notifications.dispatch();
    }

    return resolved;
  }

  return object;
}
 
Example 14
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain shadowAdd(FeatureMap.Entry.Internal entry, NotificationChain notifications)
{
  EStructuralFeature feature = entry.getEStructuralFeature();
  Object value = entry.getValue();
  // EATM must fix isSet bits.
  NotificationImpl notification = 
    feature.isMany() ?
      createNotification
        (Notification.ADD,
         feature,
         null, 
         value,
         indexOf(feature, value),
         true) :
      createNotification
        (Notification.SET, 
         feature,
         feature.getDefaultValue(), 
         value,
         Notification.NO_INDEX,
         true);

  if (notifications != null)
  {
    notifications.add(notification);
  }
  else
  {
    notifications = notification;
  }
  return notifications;
}
 
Example 15
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain shadowRemove(FeatureMap.Entry.Internal entry, NotificationChain notifications)
{
  EStructuralFeature feature = entry.getEStructuralFeature();
  Object value = entry.getValue();
  NotificationImpl notification = 
    feature.isMany() ?
      createNotification
        (Notification.REMOVE,
         feature,
         value,
         null, 
         indexOf(feature, value),
         true) :
      createNotification
        (feature.isUnsettable() ? Notification.UNSET : Notification.SET, 
         feature,
         value,
         feature.getDefaultValue(), 
         Notification.NO_INDEX,
         true);

  if (notifications != null)
  {
    notifications.add(notification);
  }
  else
  {
    notifications = notification;
  }
  
  return notifications;
}
 
Example 16
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowSet(Entry oldObject, Entry newObject, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = oldObject.getEStructuralFeature();
    Object oldValue = oldObject.getValue();
    Object newValue = newObject.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         oldValue,
         newValue,
         feature.isMany() ? indexOf(feature, newValue) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 17
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain inverseTouch(Object object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    Entry entry = (Entry)object;
    EStructuralFeature feature = entry.getEStructuralFeature();
    Object value = entry.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         value, 
         value,
         feature.isMany() ? indexOf(feature, value) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }

  return notifications;
}
 
Example 18
Project: eclipse-avro   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
public Object resolveProxy(EStructuralFeature feature, int entryIndex, int index, Object object)
{
  EObject resolved = resolveProxy((EObject)object);
  if (resolved != object)
  {
    Entry oldObject = delegateGet(entryIndex);
    Entry entry = createEntry(feature, resolved);
    delegateSet(entryIndex, validate(entryIndex, entry));
    didSet(entryIndex, entry, oldObject);

    if (isNotificationRequired())
    {
      NotificationImpl notifications = 
        createNotification
          (Notification.RESOLVE, 
           entry.getEStructuralFeature(), 
           object,
           resolved,
           index,
           false);

      notifications.add(createNotification(Notification.RESOLVE, oldObject, entry, index, false));
      notifications.dispatch();
    }

    return resolved;
  }

  return object;
}
 
Example 19
Project: eclipse-avro   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowAdd(Entry object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = object.getEStructuralFeature();
    Object value = object.getValue();
    // EATM must fix isSet bits.
    NotificationImpl notification = 
      feature.isMany() ?
        createNotification
          (Notification.ADD,
           feature,
           null, 
           value,
           indexOf(feature, value),
           true) :
        createNotification
          (Notification.SET, 
           feature,
           feature.getDefaultValue(), 
           value,
           Notification.NO_INDEX,
           true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 20
Project: eclipse-avro   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowRemove(Entry object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = object.getEStructuralFeature();
    Object value = object.getValue();
    NotificationImpl notification = 
      feature.isMany() ?
        createNotification
          (Notification.REMOVE,
           feature,
           value,
           null, 
           indexOf(feature, value),
           true) :
        createNotification
          (feature.isUnsettable() ? Notification.UNSET : Notification.SET, 
           feature,
           value,
           feature.getDefaultValue(), 
           Notification.NO_INDEX,
           true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 21
Project: eclipse-avro   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowSet(Entry oldObject, Entry newObject, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = oldObject.getEStructuralFeature();
    Object oldValue = oldObject.getValue();
    Object newValue = newObject.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         oldValue,
         newValue,
         feature.isMany() ? indexOf(feature, newValue) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 22
Project: eclipse-avro   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain inverseTouch(Object object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    Entry entry = (Entry)object;
    EStructuralFeature feature = entry.getEStructuralFeature();
    Object value = entry.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         value, 
         value,
         feature.isMany() ? indexOf(feature, value) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }

  return notifications;
}
 
Example 23
Project: clickwatch   File: ResourceImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the load state as indicated, and returns a notification, if {@link org.eclipse.emf.common.notify.impl.BasicNotifierImpl#eNotificationRequired required}.
 * Clients are <b>not</b> expected to call this directly; it is managed by the implementation.
 * @param isLoaded whether the resource is loaded.
 * @return a notification.
 */
protected Notification setLoaded(boolean isLoaded)
{
  boolean oldIsLoaded = this.isLoaded;
  this.isLoaded = isLoaded;

  if (eNotificationRequired())
  {
    Notification notification =
      new NotificationImpl(Notification.SET, oldIsLoaded, isLoaded)
      {
        @Override
        public Object getNotifier()
        {
          return ResourceImpl.this;
        }

        @Override
        public int getFeatureID(Class<?> expectedClass)
        {
          return RESOURCE__IS_LOADED;
        }
      };
    return notification;
  }
  else
  {
    return null;
  }
}
 
Example 24
Project: clickwatch   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public Object resolveProxy(EStructuralFeature feature, int entryIndex, int index, Object object)
{
  EObject resolved = resolveProxy((EObject)object);
  if (resolved != object)
  {
    Entry oldObject = (Entry)data[entryIndex];
    Entry entry = createEntry(feature, resolved);
    assign(entryIndex, validate(entryIndex, entry));
    didSet(entryIndex, entry, oldObject);

    if (isNotificationRequired())
    {
      NotificationImpl notifications = 
        createNotification
          (Notification.RESOLVE, 
           entry.getEStructuralFeature(), 
           object,
           resolved,
           index,
           false);

      notifications.add(createNotification(Notification.RESOLVE, oldObject, entry, index, false));
      notifications.dispatch();
    }

    return resolved;
  }

  return object;
}
 
Example 25
Project: clickwatch   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain shadowAdd(FeatureMap.Entry.Internal entry, NotificationChain notifications)
{
  EStructuralFeature feature = entry.getEStructuralFeature();
  Object value = entry.getValue();
  // EATM must fix isSet bits.
  NotificationImpl notification = 
    feature.isMany() ?
      createNotification
        (Notification.ADD,
         feature,
         null, 
         value,
         indexOf(feature, value),
         true) :
      createNotification
        (Notification.SET, 
         feature,
         feature.getDefaultValue(), 
         value,
         Notification.NO_INDEX,
         true);

  if (notifications != null)
  {
    notifications.add(notification);
  }
  else
  {
    notifications = notification;
  }
  return notifications;
}
 
Example 26
Project: clickwatch   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain shadowRemove(FeatureMap.Entry.Internal entry, NotificationChain notifications)
{
  EStructuralFeature feature = entry.getEStructuralFeature();
  Object value = entry.getValue();
  NotificationImpl notification = 
    feature.isMany() ?
      createNotification
        (Notification.REMOVE,
         feature,
         value,
         null, 
         indexOf(feature, value),
         true) :
      createNotification
        (feature.isUnsettable() ? Notification.UNSET : Notification.SET, 
         feature,
         value,
         feature.getDefaultValue(), 
         Notification.NO_INDEX,
         true);

  if (notifications != null)
  {
    notifications.add(notification);
  }
  else
  {
    notifications = notification;
  }
  
  return notifications;
}
 
Example 27
Project: clickwatch   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowSet(Entry oldObject, Entry newObject, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = oldObject.getEStructuralFeature();
    Object oldValue = oldObject.getValue();
    Object newValue = newObject.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         oldValue,
         newValue,
         feature.isMany() ? indexOf(feature, newValue) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 28
Project: clickwatch   File: BasicFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain inverseTouch(Object object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    Entry entry = (Entry)object;
    EStructuralFeature feature = entry.getEStructuralFeature();
    Object value = entry.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         value, 
         value,
         feature.isMany() ? indexOf(feature, value) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }

  return notifications;
}
 
Example 29
Project: clickwatch   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
public Object resolveProxy(EStructuralFeature feature, int entryIndex, int index, Object object)
{
  EObject resolved = resolveProxy((EObject)object);
  if (resolved != object)
  {
    Entry oldObject = delegateGet(entryIndex);
    Entry entry = createEntry(feature, resolved);
    delegateSet(entryIndex, validate(entryIndex, entry));
    didSet(entryIndex, entry, oldObject);

    if (isNotificationRequired())
    {
      NotificationImpl notifications = 
        createNotification
          (Notification.RESOLVE, 
           entry.getEStructuralFeature(), 
           object,
           resolved,
           index,
           false);

      notifications.add(createNotification(Notification.RESOLVE, oldObject, entry, index, false));
      notifications.dispatch();
    }

    return resolved;
  }

  return object;
}
 
Example 30
Project: clickwatch   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowAdd(Entry object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = object.getEStructuralFeature();
    Object value = object.getValue();
    // EATM must fix isSet bits.
    NotificationImpl notification = 
      feature.isMany() ?
        createNotification
          (Notification.ADD,
           feature,
           null, 
           value,
           indexOf(feature, value),
           true) :
        createNotification
          (Notification.SET, 
           feature,
           feature.getDefaultValue(), 
           value,
           Notification.NO_INDEX,
           true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 31
Project: clickwatch   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowRemove(Entry object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = object.getEStructuralFeature();
    Object value = object.getValue();
    NotificationImpl notification = 
      feature.isMany() ?
        createNotification
          (Notification.REMOVE,
           feature,
           value,
           null, 
           indexOf(feature, value),
           true) :
        createNotification
          (feature.isUnsettable() ? Notification.UNSET : Notification.SET, 
           feature,
           value,
           feature.getDefaultValue(), 
           Notification.NO_INDEX,
           true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 32
Project: clickwatch   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
@Override
public NotificationChain shadowSet(Entry oldObject, Entry newObject, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    EStructuralFeature feature = oldObject.getEStructuralFeature();
    Object oldValue = oldObject.getValue();
    Object newValue = newObject.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         oldValue,
         newValue,
         feature.isMany() ? indexOf(feature, newValue) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }
  return notifications;
}
 
Example 33
Project: clickwatch   File: DelegatingFeatureMap.java   Source Code and License 5 votes vote down vote up
public NotificationChain inverseTouch(Object object, NotificationChain notifications)
{
  if (isNotificationRequired())
  {
    Entry entry = (Entry)object;
    EStructuralFeature feature = entry.getEStructuralFeature();
    Object value = entry.getValue();
    NotificationImpl notification = 
      createNotification
        (Notification.SET,
         feature,
         value, 
         value,
         feature.isMany() ? indexOf(feature, value) : Notification.NO_INDEX,
         true);

    if (notifications != null)
    {
      notifications.add(notification);
    }
    else
    {
      notifications = notification;
    }
  }

  return notifications;
}
 
Example 34
Project: statecharts   File: DerivedEObjectEList.java   Source Code and License 4 votes vote down vote up
protected NotificationImpl createNotification(int eventType,
		Object oldObject, Object newObject, int index, boolean wasSet) {
	return new ENotificationImpl(owner, eventType, featureID, oldObject,
			newObject, index, wasSet);
}
 
Example 35
Project: emfstore-rest   File: NotificationToOperationConverterTest.java   Source Code and License 4 votes vote down vote up
/**
 * Test an invalid event type.
 */
@Test
public void invalidEventType() {
	Assert.assertNull(converter.convert(new NotificationInfo(new NotificationImpl(Integer.MIN_VALUE, null, null))));

}
 
Example 36
Project: emfstore-rest   File: NotificationToOperationConverterTest.java   Source Code and License 4 votes vote down vote up
/**
 * Test a notification which is only touch.
 */
@Test
public void onlyTouch() {
	Assert.assertNull(converter
		.convert(new NotificationInfo(new NotificationImpl(Notification.RESOLVE, null, null))));
}
 
Example 37
Project: eclipse-avro   File: DelegatingEcoreEList.java   Source Code and License 4 votes vote down vote up
@Override
protected NotificationImpl createNotification(int eventType, Object oldObject, Object newObject, int index, boolean wasSet)
{
  return new ENotificationImpl(owner, eventType, getFeatureID(), oldObject, newObject, index, wasSet);
}
 
Example 38
Project: eclipse-avro   File: DelegatingEcoreEList.java   Source Code and License 4 votes vote down vote up
protected NotificationImpl createNotification(int eventType, boolean oldValue, boolean newValue)
{
  return new ENotificationImpl(owner, eventType, getFeatureID(), oldValue, newValue);
}
 
Example 39
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 4 votes vote down vote up
protected NotificationImpl createNotification
  (int eventType, EStructuralFeature feature, Object oldObject, Object newObject, int index, boolean wasSet)
{
  return new FeatureMapUtil.FeatureENotificationImpl(owner, eventType, feature, oldObject, newObject, index, wasSet);
}
 
Example 40
Project: eclipse-avro   File: BasicFeatureMap.java   Source Code and License 4 votes vote down vote up
@Override
public NotificationChain basicRemove(Object object, NotificationChain notifications)
{
  // This may be called directly on an EObject for the case of a containment.
  //
  if (object instanceof FeatureMap.Entry)
  {
    return super.basicRemove(object, notifications);
  }
  else
  {
    Entry match = null;
    EStructuralFeature feature = null;
    Entry [] entries = (Entry[])data;
    for (int i = 0; i < size; ++i)
    {
      Entry entry = entries[i];
      if (object.equals(entry.getValue()))
      {
        feature = entry.getEStructuralFeature();
        if (feature instanceof EReference && ((EReference)feature).isContainment())
        {
          match = entry;
          break;
        }
      }
    }

    if (match != null)
    {
      if (isNotificationRequired())
      {
        @SuppressWarnings("null")
        NotificationImpl notification =
          feature.isMany() ?
            createNotification
              (Notification.REMOVE,
               feature,
               object,
               null,
               indexOf(feature, object),
               true) :
            createNotification
              (feature.isUnsettable() ? Notification.UNSET : Notification.SET,
               feature,
               object,
               feature.getDefaultValue(),
               Notification.NO_INDEX,
               true);

        if (notifications != null)
        {
          notifications.add(notification);
        }
        else
        {
          notifications = notification;
        }
      }
      notifications = basicRemove(match, notifications);
    }

    return notifications;
  }
}