/** {@inheritedDoc} */ public void notifyChanged(Notification notification) { // change the label of the figure managed by the host edit part (managed // by the parent edit // part in general...) // it must be changed only if: // - the annotation corresponding to the display of the stereotype // changes // - the stereotype application list has changed final int eventType = notification.getEventType(); if (eventType == PapyrusStereotypeListener.APPLIED_STEREOTYPE) { // a stereotype was applied to the notifier // then a new listener should be added to the stereotype application getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this); createAppliedStereotypeCompartment((EObject) notification.getNewValue()); } else if (eventType == PapyrusStereotypeListener.UNAPPLIED_STEREOTYPE) { getDiagramEventBroker() .removeNotificationListener((EObject) notification.getOldValue(), this); removeAppliedStereotypeCompartment((EObject) notification.getNewValue()); } // if element that has changed is a stereotype => refresh the label. if (notification.getNotifier() instanceof Node && (notification.getEventType() == Notification.ADD) && (notification.getNewValue() instanceof EAnnotation)) { if (UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION == ((EAnnotation) notification.getNewValue()).getSource()) { // stereotype annotation has changed => refresh label display refreshDisplay(); } } }
/** * Add the following notifications to the list to be processed at the next asynchronous * opportunity. Returns true if any of the notifications could remove, add, or change any * violations. * * @param notifications * @return boolean */ public final boolean enqueue(List<Notification> notifications) { Boolean isPaused = null; List<Notification> filtered = new ArrayList<Notification>(); for (Notification notification : notifications) { if (notification.getEventType() == Notification.RESOLVE) { continue; } else if (notification.getEventType() == ControlNotification.PAUSE) { isPaused = true; continue; } else if (notification.getEventType() == ControlNotification.RESUME) { isPaused = false; filtered.add(notification); continue; } if (isImportant(notification)) { filtered.add(notification); } } if (filtered.isEmpty() && (isPaused == null || !isPaused)) { return false; } synchronized (queueLock) { if (isPaused != null) { paused = isPaused; } queuedNotifications.addAll(filtered); queueLock.notify(); } return !paused; }
public static Collection<EObject> getAffectedValues(Notification notification, EClass clz) { if (notification.isTouch()) { return Collections.emptyList(); } switch (notification.getEventType()) { case Notification.ADD: case Notification.SET: if (clz.isInstance(notification.getNewValue())) { return Collections.singletonList((EObject) notification.getNewValue()); } return Collections.emptyList(); case Notification.REMOVE: case Notification.UNSET: if (clz.isInstance(notification.getOldValue())) { return Collections.singletonList((EObject) notification.getOldValue()); } case Notification.ADD_MANY: return affectingObjects(notification.getNewValue(), clz); case Notification.REMOVE_MANY: return affectingObjects(notification.getOldValue(), clz); case Notification.MOVE: if (notification.getNotifier() instanceof EObject && notification.getFeature() instanceof EStructuralFeature) { return affectingObjects( ((EObject) notification.getNotifier()) .eGet((EStructuralFeature) notification.getFeature()), clz); } return Collections.emptyList(); } return Collections.emptyList(); }
/** * @see * org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification) * @param notification */ public void notifyChanged(Notification notification) { Object feature = notification.getFeature(); boolean headChanged = false; if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { headChanged = true; } else if (notification.getNotifier() instanceof EAnnotation && UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION == ((EAnnotation) notification.getNotifier()).getSource()) { headChanged = true; } else if ((notification.getNotifier() instanceof DynamicEObjectImpl) && (hostSemanticElement != null) && (hostSemanticElement.getStereotypeApplications().contains(notification.getNotifier()))) { headChanged = true; } else if (PapyrusStereotypeListener.MODIFIED_STEREOTYPE == notification.getEventType()) { headChanged = true; } else if (notification instanceof StereotypeCustomNotification) { headChanged = true; } if (headChanged) { Display.getDefault() .asyncExec( new Runnable() { public void run() { impactLayout(); } }); } }
protected void handleResourceContents(Notification msg) { Resource.Internal resource = (Resource.Internal) msg.getNotifier(); // Don't report addition of roots when loading nor removal of roots when unloading // because loading and unloading are semantically more significant events if (resource.isLoaded() && !resource.isLoading()) { switch (msg.getEventType()) { case Notification.ADD: handleRootAdded(resource, (EObject) msg.getNewValue()); break; case Notification.ADD_MANY: for (Object next : (Iterable<?>) msg.getNewValue()) { handleRootAdded(resource, (EObject) next); } break; case Notification.REMOVE: handleRootRemoved(resource, (EObject) msg.getOldValue()); break; case Notification.REMOVE_MANY: for (Object next : (Iterable<?>) msg.getOldValue()) { handleRootRemoved(resource, (EObject) next); } break; case Notification.SET: handleRootRemoved(resource, (EObject) msg.getOldValue()); handleRootAdded(resource, (EObject) msg.getNewValue()); break; } } }
@Override public void notifyChanged(Notification notification) { assert getHost() != null; if (notification.getEventType() != Notification.SET) return; boolean hasChanged = false; switch (notification.getFeatureID(GridLayoutRule.class)) { case SWTStylesPackage.GRID_LAYOUT_RULE__MAKE_COLUMNS_EQUAL_WIDTH: hasChanged = !CompareUtils.areEquals( notification.getOldBooleanValue(), notification.getNewBooleanValue()); break; case SWTStylesPackage.GRID_LAYOUT_RULE__HORIZONTAL_SPACING: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_BOTTOM: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_HEIGHT: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_LEFT: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_RIGHT: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_TOP: case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_WIDTH: case SWTStylesPackage.GRID_LAYOUT_RULE__NUM_COLUMNS: case SWTStylesPackage.GRID_LAYOUT_RULE__VERTICAL_SPACING: hasChanged = !CompareUtils.areEquals(notification.getOldIntValue(), notification.getNewIntValue()); break; default: super.notifyChanged(notification); } if (hasChanged && getHost().styleRuleUpdated((StyleRule) notification.getNotifier())) reCreateWidgetView(); }
public static boolean affects(Notification notification, EClass clz) { if (notification.isTouch()) { return false; } switch (notification.getEventType()) { case Notification.ADD: case Notification.SET: return clz.isInstance(notification.getNewValue()); case Notification.REMOVE: case Notification.UNSET: return clz.isInstance(notification.getOldValue()); case Notification.ADD_MANY: return affects(notification.getNewValue(), clz); case Notification.REMOVE_MANY: return affects(notification.getOldValue(), clz); case Notification.MOVE: if (notification.getNotifier() instanceof EObject && notification.getFeature() instanceof EStructuralFeature) { return affects( ((EObject) notification.getNotifier()) .eGet((EStructuralFeature) notification.getFeature()), clz); } return false; } return false; }
@Override protected void handleNotificationEvent(Notification notification) { super.handleNotificationEvent(notification); if ((notification.getEventType() == Notification.SET) && (notification.getNotifier() instanceof org.ow2.aspirerfid.ide.bpwme.impl.EBProcImpl)) { EBProcImpl epi = (EBProcImpl) notification.getNotifier(); EAttributeImpl ei = (EAttributeImpl) notification.getFeature(); MainControl mc = MainControl.getMainControl(); org.ow2.aspirerfid.commons.apdl.model.EBProc ebproc = (org.ow2.aspirerfid.commons.apdl.model.EBProc) mc.getMapObject(epi.hashCode()); EPCISMasterDataDocumentType doc = MasterDataUtil.getEPCISMasterDataDocument(ebproc); VocabularyElementType vocabularyElement = MasterDataUtil.getEBProcVocabularyElement(doc); if (ei.getName().equals("id")) { ebproc.setId(notification.getNewStringValue()); MasterDataUtil.setVocabularyElementID(vocabularyElement, notification.getNewStringValue()); } else if (ei.getName().equals("name")) { ebproc.setName(notification.getNewStringValue()); MasterDataUtil.setVocabularyElementAttribute( vocabularyElement, "urn:epcglobal:epcis:mda:event_name", notification.getNewStringValue()); } else if (ei.getName().equals("description")) { ebproc.setDescription(notification.getNewStringValue()); } else { return; } mc.saveObject(); } }
public void notifyChanged(final Notification notification) { switch (notification.getEventType()) { case Notification.REMOVING_ADAPTER: return; default: updatePictogramFigureStates(); } }
/* * (non-Javadoc) * * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) */ public void notifyChanged(Notification aNotification) { if (aNotification.getFeature() == ComponentcorePackage.eINSTANCE.getComponentResource_SourcePath()) { if (aNotification.getEventType() == Notification.SET) { resource = null; } } }
protected void highlight(final Notification notification, HighlightingParameters params) { int eventType = notification.getEventType(); if (eventType == ADD || eventType == ADD_MANY) { fadeIn(notification.getNewValue(), params); } else if (eventType == REMOVE || eventType == REMOVE_MANY) { fadeOut(notification.getOldValue(), params); } }
public void notifyChanged(Notification msg) { if (debug) { DebugTrace.print(this, "notifyChanged", "msg=" + msg); // $NON-NLS-1$ //$NON-NLS-2$ } if (msg.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED && msg.getEventType() == org.eclipse.emf.common.notify.Notification.SET) { firePropertyChange(msg.getNotifier(), PROP_DIRTY); } }
/** * @param event the affected event * @return returns a {@link List}of {@link Class Interfaces}which contains all implemented <code> * Interfaces</code> of the event and all of its super types. */ public Object getAffectedObject(Notification event) { if (isEmpty()) return null; // the affected object is not needed in this case Collection<Integer> result = new HashSet<Integer>(16); result.add(event.getEventType()); return result; }
protected boolean isMarkerEvent(Notification notification) { int type = notification.getEventType(); if (type == NOTIFICATION_MARKERS_STALE || type == NOTIFICATION_MARKER_ADDED || type == NOTIFICATION_MARKER_DELETED) { return true; } return false; }
private void handlePresentationRegistration(Notification notification) { if (editingDomain == null) { throw new NullPointerException("Presentation registration, but editingDomain not yet set!"); } if (notification.getEventType() == Notification.ADD) { ProrPresentationConfiguration config = (ProrPresentationConfiguration) notification.getNewValue(); System.out.println("Registering: " + config); ProrUtil.getConfigItemProvider(config, getRootAdapterFactory()) .registerPresentationConfiguration(config, editingDomain); } else if (notification.getEventType() == Notification.REMOVE) { ProrPresentationConfiguration config = (ProrPresentationConfiguration) notification.getOldValue(); System.out.println("Unregistering: " + config); ProrUtil.getConfigItemProvider(config, getRootAdapterFactory()) .unregisterPresentationConfiguration(config); } }
@Override public void notifyChanged(Notification msg) { InstanceImpl inst = (InstanceImpl) target; if (inst.cachedAdaptedEntity != null) { if (msg.getEventType() == Notification.SET && msg.getFeature() == DfPackage.Literals.INSTANCE__ENTITY) { inst.cachedAdaptedEntity = null; } } }
/** * Construct a RepositoryChangeNotification from the given notification. {@inheritDoc} * * @see * org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) */ public void notifyChanged(Notification notification) { super.notifyChanged(notification); // We don't notify handlers for removing adapter operations neither for Touch notifications if ((Notification.REMOVING_ADAPTER != (notification.getEventType())) && (!notification.isTouch())) { RepositoryChangeNotification newNotification = RepositoryChangeNotificationFactoryHolder.getChangeNotificationFactory() .createRepositoryChangeNotification(notification); this.notificator.notifyHandlers(newNotification); } }
/* (non-Javadoc) * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) */ @Override public void notifyChanged(Notification notification) { if (notification != null && (notification.getNewValue() instanceof WebSite) && notification.getEventType() == Notification.ADD) { WebSite webSite = (WebSite) notification.getNewValue(); qrSource.log("Enriching new WebSite " + webSite.getAdress(), LogService.LOG_INFO); // enrich the information objects this website belongs to qrSource.enrichInformationObjectsOfWebSite(webSite); } }
protected void handleResourceSetResources(Notification msg) { switch (msg.getEventType()) { case Notification.ADD: { Resource resource = (Resource) msg.getNewValue(); addAdapter(resource); handleResourceAdded(resource); } break; case Notification.ADD_MANY: for (Object next : (Iterable<?>) msg.getNewValue()) { Resource resource = (Resource) next; addAdapter(resource); handleResourceAdded(resource); } break; case Notification.REMOVE: { Resource resource = (Resource) msg.getOldValue(); try { handleResourceRemoved(resource); } finally { removeAdapter(resource); } break; } case Notification.REMOVE_MANY: for (Object next : (Iterable<?>) msg.getOldValue()) { Resource resource = (Resource) next; try { handleResourceRemoved(resource); } finally { removeAdapter(resource); } } break; case Notification.SET: { Resource oldResource = (Resource) msg.getOldValue(); try { handleResourceRemoved(oldResource); } finally { removeAdapter(oldResource); } Resource newResource = (Resource) msg.getOldValue(); addAdapter(newResource); handleResourceAdded(newResource); break; } } }
@Override public void notifyChanged(Notification msg) { Object notifier = msg.getNotifier(); if (!msg.isTouch()) { if (notifier instanceof ResourceSet) { if (msg.getFeatureID(ResourceSet.class) == ResourceSet.RESOURCE_SET__RESOURCES) { handleResourceSetResources(msg); } } else if (notifier instanceof Resource) { switch (msg.getFeatureID(Resource.class)) { case Resource.RESOURCE__IS_LOADED: switch (msg.getEventType()) { case Notification.SET: case Notification.UNSET: if (msg.getNewBooleanValue()) { handleResourceLoaded((Resource) notifier); } else { handleResourceUnloaded((Resource) notifier); } break; } break; case Resource.RESOURCE__URI: switch (msg.getEventType()) { case Notification.SET: case Notification.UNSET: handleResourceURI( (Resource) notifier, (URI) msg.getOldValue(), (URI) msg.getNewValue()); break; } break; case Resource.RESOURCE__CONTENTS: handleResourceContents(msg); break; } } } }
public void notifyChanged(Notification notification) { int featureId = notification.getFeatureID(target.getClass()); if (featureId != XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP) { return; } if (notification.getEventType() != Notification.ADD) { return; } if (!(notification.getNewValue() instanceof XSDElementDeclaration)) { return; } XSDElementDeclaration el = (XSDElementDeclaration) notification.getNewValue(); XSDElementDeclaration e = target; while (e != null) { synchronized (e) { ArrayList<Integer> toremove = new ArrayList(); for (int i = 0; i < e.getSubstitutionGroup().size(); i++) { XSDElementDeclaration se = (XSDElementDeclaration) e.getSubstitutionGroup().get(i); if (se == null || (Utilities.equals(el.getTargetNamespace(), se.getTargetNamespace()) && Utilities.equals(el.getName(), se.getName()))) { toremove.add(i); } } // iterate back in reverse order and skip the last element as to keep the latest // version of the element ArrayList<XSDElementDeclaration> removed = new ArrayList(); for (int i = toremove.size() - 2; i > -1; i--) { XSDElementDeclaration se = (XSDElementDeclaration) e.getSubstitutionGroup().remove(toremove.get(i).intValue()); removed.add(e); } // set the removed elements sub affiliation to a clone of the actual element for (XSDElementDeclaration se : removed) { if (se != null && e.equals(se.getSubstitutionGroupAffiliation())) { XSDElementDeclaration clone = (XSDElementDeclaration) e.cloneConcreteComponent(false, false); clone.setTargetNamespace(GML.NAMESPACE); se.setSubstitutionGroupAffiliation(clone); } } } e = e.getSubstitutionGroupAffiliation(); } }
protected boolean doRecord(Notification notification) { if (!isRecording || isSuspended || 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; } }
protected void handleNotification(ResourceSet rset, Notification msg) { switch (msg.getFeatureID(ResourceSet.class)) { case ResourceSet.RESOURCE_SET__RESOURCES: switch (msg.getEventType()) { case Notification.ADD: adapt((Resource) msg.getNewValue()); break; case Notification.ADD_MANY: for (Object next : (Collection<?>) msg.getNewValue()) { adapt((Resource) next); } break; } break; } }
@Override public void resourceSetChanged(ResourceSetChangeEvent event) { for (Notification notification : event.getNotifications()) { if (notification.getNotifier() instanceof EObject && notification.getEventType() != Notification.REMOVING_ADAPTER && notification.getEventType() != Notification.RESOLVE) { EObject eObject = (EObject) notification.getNotifier(); for (EClass eClass : eObject.eClass().getEAllSuperTypes()) { if (SGraphPackage.eINSTANCE == eClass.getEPackage()) { validationJob.cancel(); validationJob.schedule(DELAY); return; } } } } }
/** * {@inheritDoc} * * @see * org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) */ @Override public void notifyChanged(final Notification msg) { final Object notifier = msg.getNotifier(); if (notifier instanceof DDiagram) { final int featureID = msg.getFeatureID(DDiagram.class); if (featureID == DiagramPackage.DDIAGRAM__ACTIVATED_LAYERS) { switch (msg.getEventType()) { case Notification.ADD: case Notification.REMOVE: computeMappings((DDiagram) notifier, (Layer) msg.getNewValue()); break; default: break; } } } }
@Override public void notifyChanged(Notification notification) { assert getHost() != null; if (notification.getEventType() != Notification.SET) return; boolean hasChanged = false; switch (notification.getFeatureID(IntRule.class)) { case CoreStylesPackage.INT_RULE__VALUE: hasChanged = !CompareUtils.areEquals(notification.getOldIntValue(), notification.getNewIntValue()); break; case CoreStylesPackage.INT_RULE__PROPERTY_NAME: reCreateWidgetView(); return; default: super.notifyChanged(notification); } if (hasChanged && getHost().styleRuleUpdated((StyleRule) notification.getNotifier())) reCreateWidgetView(); }
@Override protected void eCoreChanged(Notification msg) { Object feature = msg.getFeature(); switch (msg.getEventType()) { case Notification.SET: // Refresh Icon if (feature == IArchimatePackage.Literals.DIAGRAM_MODEL_IMAGE_PROVIDER__IMAGE_PATH || feature == ICanvasPackage.Literals.ICONIC__IMAGE_POSITION) { ((CanvasStickyFigure) getFigure()).updateImage(); } else { super.eCoreChanged(msg); } break; default: super.eCoreChanged(msg); } }
/** * @see * org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification) * @param notification */ public void notifyChanged(Notification notification) { if (notification.getEventType() == Notification.REMOVE) { if (notification.getNotifier() instanceof Classifier) { IGraphicalEditPart gep = (IGraphicalEditPart) getDecoratorTarget().getAdapter(IGraphicalEditPart.class); assert gep != null; // we remove the listener on the container (because it's // changing DiagramEventBroker.getInstance(gep.getEditingDomain()) .removeNotificationListener( (EObject) notification.getNotifier(), notificationListener); } } // we update the listeners It's useful when an Element with overlay // changes of parent deactivate(); activate(); refresh(); }
/* * (non-Javadoc) * * @see * muvitorkit.gef.editparts.AdapterGraphicalEditPart#notifyChanged(org.eclipse * .emf.common.notify.Notification) */ @Override protected void notifyChanged(Notification notification) { final int featureId = notification.getFeatureID(HenshinPackage.class); switch (featureId) { case HenshinPackage.UNIT__NAME: ((SubUnitFigure) getFigure()).setName(getText()); break; case HenshinPackage.PARAMETER_MAPPING: final int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: refreshSourceConnections(); refreshTargetConnections(); case Notification.SET: refreshVisuals(); break; } } }
/* * (non-Javadoc) * * @see * de.tub.tfs.muvitor.gef.editparts.AdapterGraphicalEditPart#notifyChanged * (org.eclipse.emf.common.notify.Notification) */ @Override protected void notifyChanged(Notification notification) { int henshinMsgId = notification.getFeatureID(HenshinPackage.class); int msgType = notification.getEventType(); switch (henshinMsgId) { case HenshinPackage.SEQUENTIAL_UNIT__SUB_UNITS: getCastedModel().eSetDeliver(false); if (msgType == Notification.ADD && notification.getNewValue() == getCastedModel().getModel()) { getCastedModel().setCounter(getCastedModel().getCounter() + 1); } getCastedModel().eSetDeliver(true); break; default: break; } refresh(); }