Java Code Examples for org.eclipse.emf.common.notify.Notification#ADD
The following examples show how to use
org.eclipse.emf.common.notify.Notification#ADD .
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 |
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 |
@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 |
/** * 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); }
Example 4
Source File: DerivedAttributeAdapter.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void notifyChanged ( final Notification notification ) { if ( notification.getFeature () == null ) { return; } if ( notification.getFeature ().equals ( this.navigationFeature ) ) { switch ( notification.getEventType () ) { // TODO support ADD_MANY/REMOVE_MANY? case Notification.ADD: final EObject added = (EObject)notification.getNewValue (); added.eAdapters ().add ( this.dependantAdapter ); break; case Notification.SET: final EObject newValue = (EObject)notification.getNewValue (); final EObject oldValue = (EObject)notification.getOldValue (); if ( oldValue != null ) { oldValue.eAdapters ().remove ( this.dependantAdapter ); } if ( newValue != null ) { newValue.eAdapters ().add ( this.dependantAdapter ); } break; case Notification.REMOVE: final EObject removed = (EObject)notification.getOldValue (); removed.eAdapters ().remove ( this.dependantAdapter ); break; default: return; // No notification } notifyDerivedAttributeChange (); } else if ( this.localFeatures.contains ( notification.getFeature () ) ) { notifyDerivedAttributeChange (); } }