Java Code Examples for org.eclipse.emf.common.notify.Notification#ADD_MANY

The following examples show how to use org.eclipse.emf.common.notify.Notification#ADD_MANY . 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: DefaultTextEditComposer.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected boolean doRecord(Notification notification) {
	if (!recording || notification.isTouch())
		return false;

	switch (notification.getEventType()) {
		case Notification.ADD:
		case Notification.ADD_MANY:
		case Notification.MOVE:
		case Notification.REMOVE:
		case Notification.REMOVE_MANY:
		case Notification.SET:
		case Notification.UNSET:
			return true;
		default:
			return false;
	}
}
 
Example 2
Source File: AbstractEReferenceChangedListener.java    From kieker with Apache License 2.0 6 votes vote down vote up
@Override
public final void notifyChanged(final Notification notification) {
	if (notification.getFeature() == this.listenedFeature) {
		switch (notification.getEventType()) {
		case Notification.ADD:
			this.notifyElementAddedIntern(notification.getNewValue());
			break;
		case Notification.ADD_MANY:
			final List<?> addedOperationTypes = (List<?>) notification.getNewValue();
			addedOperationTypes.forEach(o -> this.notifyElementAddedIntern(o));
			break;
		case Notification.REMOVE:
			this.notifyElementRemovedIntern(notification.getOldValue());
			break;
		case Notification.REMOVE_MANY:
			final List<?> removedOperationTypes = (List<?>) notification.getOldValue();
			removedOperationTypes.forEach(o -> this.notifyElementRemovedIntern(o));
			break;
		default:
			break;
		}
	}

	super.notifyChanged(notification);
}
 
Example 3
Source File: TinkerforgeBinding.java    From openhab1-addons with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Adds a listener {@link EContentAdapter} to the {@link Ecosystem}. The listener handles updated
 * sensor values and posts them to the openhab eventbus by
 * {@link #processTFDeviceValues(Notification) processTFDeviceValues}. Furthermore the addition
 * and removal of devices is handled by {@link #initializeTFDevices(Notification)
 * initializeTFDevices}.
 *
 * @param tinkerforgeEcosystem The EMF Ecosystem object.
 */
private void listen2Model(Ecosystem tinkerforgeEcosystem) {
    EContentAdapter modelAdapter = new EContentAdapter() {
        @Override
        public void notifyChanged(Notification notification) {
            super.notifyChanged(notification);
            logger.debug("TinkerforgeNotifier was notified");
            if (notification.getEventType() == Notification.ADD
                    || notification.getEventType() == Notification.ADD_MANY
                    || notification.getEventType() == Notification.REMOVE
                    || notification.getEventType() == Notification.REMOVE_MANY) {
                initializeTFDevices(notification);
            } else {
                processTFDeviceValues(notification);
            }
        }

    };
    tinkerforgeEcosystem.eAdapters().add(modelAdapter);
}