Ejemplo n.º 1
0
  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;
      }
    }
  }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     CommandPropertiesEditionPart basePart = (CommandPropertiesEditionPart) editingPart;
     if (StatemachinePackage.eINSTANCE.getCommand_Name().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && basePart != null
         && isAccessible(StatemachineViewsRepository.Command.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
     if (StatemachinePackage.eINSTANCE.getCommand_Code().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && basePart != null
         && isAccessible(StatemachineViewsRepository.Command.Properties.code)) {
       if (msg.getNewValue() != null) {
         basePart.setCode(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setCode("");
       }
     }
   }
 }
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
   */
  public void updatePart(Notification msg) {
    if (editingPart.isVisible()) {
      LinkEndDestructionDataPropertiesEditionPart basePart =
          (LinkEndDestructionDataPropertiesEditionPart) editingPart;
      if (UMLPackage.eINSTANCE.getLinkEndData_Value().equals(msg.getFeature())
          && basePart != null
          && isAccessible(UmlViewsRepository.LinkEndDestructionData.Properties.value))
        basePart.setValue((EObject) msg.getNewValue());
      if (UMLPackage.eINSTANCE.getLinkEndData_End().equals(msg.getFeature())
          && basePart != null
          && isAccessible(UmlViewsRepository.LinkEndDestructionData.Properties.end))
        basePart.setEnd((EObject) msg.getNewValue());
      if (UMLPackage.eINSTANCE
              .getLinkEndDestructionData_IsDestroyDuplicates()
              .equals(msg.getFeature())
          && basePart != null
          && isAccessible(UmlViewsRepository.LinkEndDestructionData.Properties.isDestroyDuplicates))
        basePart.setIsDestroyDuplicates((Boolean) msg.getNewValue());

      if (UMLPackage.eINSTANCE.getLinkEndDestructionData_DestroyAt().equals(msg.getFeature())
          && basePart != null
          && isAccessible(UmlViewsRepository.LinkEndDestructionData.Properties.destroyAt))
        basePart.setDestroyAt((EObject) msg.getNewValue());
    }
  }
 /** {@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();
     }
   }
 }
	/**
	 * {@inheritDoc}
	 * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
	 */
	public void updatePart(Notification msg) {
		super.updatePart(msg);
		if (editingPart.isVisible()) {
			ArtifactIdentifierPropertiesEditionPart basePart = (ArtifactIdentifierPropertiesEditionPart)editingPart;
			if (ScoPackage.eINSTANCE.getArtifactIdentifier_ResourceName().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.resourceName)) {
				if (msg.getNewValue() != null) {
					basePart.setResourceName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
				} else {
					basePart.setResourceName("");
				}
			}
			if (ScoPackage.eINSTANCE.getArtifactIdentifier_BaselinedLineCount().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.baselinedLineCount)) {
				if (msg.getNewValue() != null) {
					basePart.setBaselinedLineCount(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
				} else {
					basePart.setBaselinedLineCount("");
				}
			}
			if (ScoPackage.eINSTANCE.getArtifactIdentifier_CurrentLineCount().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(ScoViewsRepository.ArtifactIdentifier.Properties.currentLineCount)) {
				if (msg.getNewValue() != null) {
					basePart.setCurrentLineCount(EcoreUtil.convertToString(EcorePackage.Literals.EINT, msg.getNewValue()));
				} else {
					basePart.setCurrentLineCount("");
				}
			}
			
		}
	}
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     RotateAnimationPropertiesEditionPart basePart =
         (RotateAnimationPropertiesEditionPart) editingPart;
     if (DroidPackage.eINSTANCE.getTerminalAnimationElements_FromAlpha().equals(msg.getFeature())
         && basePart != null
         && isAccessible(DroidViewsRepository.RotateAnimation.Properties.fromAlpha)) {
       if (msg.getNewValue() != null) {
         basePart.setFromAlpha(
             EcoreUtil.convertToString(
                 EcorePackage.eINSTANCE.getEFloatObject(), msg.getNewValue()));
       } else {
         basePart.setFromAlpha("");
       }
     }
     if (DroidPackage.eINSTANCE.getTerminalAnimationElements_ToAlpha().equals(msg.getFeature())
         && basePart != null
         && isAccessible(DroidViewsRepository.RotateAnimation.Properties.toAlpha)) {
       if (msg.getNewValue() != null) {
         basePart.setToAlpha(
             EcoreUtil.convertToString(
                 EcorePackage.eINSTANCE.getEFloatObject(), msg.getNewValue()));
       } else {
         basePart.setToAlpha("");
       }
     }
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     FlowEventPropertiesEditionPart flowEventPart = (FlowEventPropertiesEditionPart) editingPart;
     if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && flowEventPart != null
         && isAccessible(FlowViewsRepository.FlowEvent.Properties.description)) {
       if (msg.getNewValue() != null) {
         flowEventPart.setDescription(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         flowEventPart.setDescription("");
       }
     }
     if (CinematicPackage.eINSTANCE.getNamedElement_Name().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && flowEventPart != null
         && isAccessible(FlowViewsRepository.FlowEvent.Properties.name)) {
       if (msg.getNewValue() != null) {
         flowEventPart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         flowEventPart.setName("");
       }
     }
     if (FlowPackage.eINSTANCE.getFlowEvent_Binds().equals(msg.getFeature())
         && isAccessible(FlowViewsRepository.FlowEvent.Properties.binds))
       flowEventPart.updateBinds();
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     NamespacePropertiesEditionPart namespacePart = (NamespacePropertiesEditionPart) editingPart;
     if (EnvironmentPackage.eINSTANCE.getNamespace_Name().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && namespacePart != null
         && isAccessible(EnvironmentViewsRepository.Namespace.Properties.name)) {
       if (msg.getNewValue() != null) {
         namespacePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         namespacePart.setName("");
       }
     }
     if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && namespacePart != null
         && isAccessible(EnvironmentViewsRepository.Namespace.Properties.description)) {
       if (msg.getNewValue() != null) {
         namespacePart.setDescription(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         namespacePart.setDescription("");
       }
     }
   }
 }
 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();
 }
Ejemplo n.º 10
0
 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;
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     PropertiesEditionElementPropertiesEditionPart basePart =
         (PropertiesEditionElementPropertiesEditionPart) editingPart;
     if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Name().equals(msg.getFeature())
         && basePart != null
         && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
     if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Views().equals(msg.getFeature())
         && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.views))
       basePart.updateViews();
     if (MappingPackage.eINSTANCE.getEMFPropertyBinding_Model().equals(msg.getFeature())
         && basePart != null
         && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.model))
       basePart.setModel((EObject) msg.getNewValue());
     if (ComponentsPackage.eINSTANCE.getEEFElement_HelpID().equals(msg.getFeature())
         && basePart != null
         && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.helpID)) {
       if (msg.getNewValue() != null) {
         basePart.setHelpID(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setHelpID("");
       }
     }
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     ConsistencyPropertiesEditionPart basePart = (ConsistencyPropertiesEditionPart) editingPart;
     if (SACMPackage.eINSTANCE.getModelElement_Id().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && basePart != null
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.id)) {
       if (msg.getNewValue() != null) {
         basePart.setId(EcoreUtil.convertToString(SACMPackage.Literals.STRING, msg.getNewValue()));
       } else {
         basePart.setId("");
       }
     }
     if (EvidencePackage.eINSTANCE.getEvidenceElement_Timing().equals(msg.getFeature())
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.timing))
       basePart.updateTiming();
     if (EvidencePackage.eINSTANCE.getEvidenceElement_Custody().equals(msg.getFeature())
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.custody))
       basePart.updateCustody();
     if (EvidencePackage.eINSTANCE.getEvidenceElement_Provenance().equals(msg.getFeature())
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.provenance))
       basePart.updateProvenance();
     if (EvidencePackage.eINSTANCE.getEvidenceElement_Event().equals(msg.getFeature())
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.event))
       basePart.updateEvent();
     if (EvidencePackage.eINSTANCE.getConsistency_Value().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && isAccessible(EvidenceViewsRepository.Consistency.Properties.value))
       basePart.setValue((ConsistencyLevel) msg.getNewValue());
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     DomainClassPropertiesEditionPart domainClassPart =
         (DomainClassPropertiesEditionPart) editingPart;
     if (EnvironmentPackage.eINSTANCE.getType_Name().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && domainClassPart != null
         && isAccessible(GraalViewsRepository.DomainClass.Properties.name)) {
       if (msg.getNewValue() != null) {
         domainClassPart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         domainClassPart.setName("");
       }
     }
     if (EnvironmentPackage.eINSTANCE.getStructuredType_Supertype().equals(msg.getFeature())
         && domainClassPart != null
         && isAccessible(GraalViewsRepository.DomainClass.Properties.superType))
       domainClassPart.setSuperType((EObject) msg.getNewValue());
     if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && domainClassPart != null
         && isAccessible(GraalViewsRepository.DomainClass.Properties.description)) {
       if (msg.getNewValue() != null) {
         domainClassPart.setDescription(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         domainClassPart.setDescription("");
       }
     }
   }
 }
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
   */
  public void updatePart(Notification msg) {
    super.updatePart(msg);
    if (editingPart.isVisible()) {
      ReferencePropertiesEditionPart referencePart = (ReferencePropertiesEditionPart) editingPart;
      if (EnvironmentPackage.eINSTANCE.getProperty_Name().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.name)) {
        if (msg.getNewValue() != null) {
          referencePart.setName(
              EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
        } else {
          referencePart.setName("");
        }
      }
      if (EnvironmentPackage.eINSTANCE.getReference_ReferencedType().equals(msg.getFeature())
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.referencedType))
        referencePart.setReferencedType((EObject) msg.getNewValue());
      if (EnvironmentPackage.eINSTANCE.getProperty_Multiplicity().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.multiplicity))
        referencePart.setMultiplicity((MultiplicityKind) msg.getNewValue());

      if (EnvironmentPackage.eINSTANCE.getReference_IsComposite().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.isComposite))
        referencePart.setIsComposite((Boolean) msg.getNewValue());

      if (EnvironmentPackage.eINSTANCE.getReference_Navigable().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.navigable))
        referencePart.setNavigable((Boolean) msg.getNewValue());

      if (EnvironmentPackage.eINSTANCE.getReference_OppositeOf().equals(msg.getFeature())
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.oppositeOf))
        referencePart.setOppositeOf((EObject) msg.getNewValue());
      if (EnvironmentPackage.eINSTANCE.getProperty_IsIdentifier().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.identifier))
        referencePart.setIdentifier((Boolean) msg.getNewValue());

      if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature())
          && msg.getNotifier().equals(semanticObject)
          && referencePart != null
          && isAccessible(EnvironmentViewsRepository.Reference.Properties.description)) {
        if (msg.getNewValue() != null) {
          referencePart.setDescription(
              EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
        } else {
          referencePart.setDescription("");
        }
      }
    }
  }
Ejemplo n.º 15
0
  /* (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);
    }
  }
Ejemplo n.º 16
0
  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;
        }
    }
  }
  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();
    }
  }
 /** @generated */
 protected void handleNotificationEvent(Notification event) {
   Object feature = event.getFeature();
   if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
     Integer c = (Integer) event.getNewValue();
     setFontColor(DiagramColorRegistry.getInstance().getColor(c));
   } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
     refreshUnderline();
   } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
     refreshStrikeThrough();
   } else 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)) {
     refreshFont();
   } else {
     if (getParser() != null
         && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
       refreshLabel();
     }
     if (getParser() instanceof ISemanticParser) {
       ISemanticParser modelParser = (ISemanticParser) getParser();
       if (modelParser.areSemanticElementsAffected(null, event)) {
         removeSemanticListeners();
         if (resolveSemanticElement() != null) {
           addSemanticListeners();
         }
         refreshLabel();
       }
     }
   }
   super.handleNotificationEvent(event);
 }
        @Override
        public void notifyChanged(final Notification msg) {
          switch (msg.getFeatureID(SdrPackage.class)) {
            case SdrPackage.SDR_ROOT__LOAD_STATUS:
              // The value is the changed load status which will go to null during loading
              // once loading is finished the status will change to reflect that of the SDRROOT.
              if (msg.getNewValue() != null) {
                Job refreshExternalSettingProviderJob =
                    new Job("Refresh External Settings Providers") {

                      @Override
                      protected IStatus run(IProgressMonitor monitor) {
                        CoreModel.getDefault()
                            .getProjectDescriptionManager()
                            .updateExternalSettingsProviders(
                                new String[] {ExternalSettingProvider.ID}, monitor);
                        return Status.OK_STATUS;
                      }
                    };
                refreshExternalSettingProviderJob.setSystem(true); // hide from progress monitor
                refreshExternalSettingProviderJob.setUser(false);
                refreshExternalSettingProviderJob.schedule(1000);
              }
              break;
            default:
              break;
          }
        }
Ejemplo n.º 20
0
 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;
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     DatetimePropertiesEditionPart basePart = (DatetimePropertiesEditionPart) editingPart;
     if (SACMPackage.eINSTANCE.getDatetime_Datetime().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && basePart != null
         && isAccessible(SACMViewsRepository.Datetime.Properties.datetime_)) {
       if (msg.getNewValue() != null) {
         basePart.setDatetime(
             EcoreUtil.convertToString(SACMPackage.Literals.STRING, msg.getNewValue()));
       } else {
         basePart.setDatetime("");
       }
     }
   }
 }
 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);
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     SkillPropertiesEditionPart basePart = (SkillPropertiesEditionPart) editingPart;
     if (EefPrimerPackage.eINSTANCE.getSkill_Name().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && basePart != null
         && isAccessible(EefprimerViewsRepository.Skill.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
   }
 }
 public void notifyChanged(Notification notification) {
   if (diagramResourceModifiedFilter.matches(notification)) {
     Object value = notification.getNewValue();
     if (value instanceof Resource) {
       ((Resource) value).setTrackingModification(true);
     }
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   super.updatePart(msg);
   if (editingPart.isVisible()) {
     DocumentationPropertiesEditionPart documentationPart =
         (DocumentationPropertiesEditionPart) editingPart;
     if (MappingPackage.eINSTANCE.getDocumentedElement_Documentation().equals(msg.getFeature())
         && msg.getNotifier().equals(semanticObject)
         && documentationPart != null
         && isAccessible(MappingViewsRepository.Documentation.Documentation_.documentation__)) {
       if (msg.getNewValue() != null) {
         documentationPart.setDocumentation(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         documentationPart.setDocumentation("");
       }
     }
   }
 }
Ejemplo n.º 26
0
 public void notifyChanged(Notification notification) {
   if (notification.getNotifier() == value
       && !(notification.getOldValue() instanceof InsertionAdapter)) {
     // execute if an attribute in the new value has changed
     execute();
   } else if (notification.getNotifier() == object && notification.getNewValue() == value) {
     // if the new value has been added to the object, we can remove this adapter
     object.eAdapters().remove(this);
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     ProcessComponentPropertiesEditionPart basePart =
         (ProcessComponentPropertiesEditionPart) editingPart;
     if (SpemPackage.eINSTANCE.getProcessPackageableElement_Name().equals(msg.getFeature())
         && basePart != null
         && isAccessible(SpemViewsRepository.ProcessComponent.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
     if (SpemPackage.eINSTANCE.getProcessPackage_OwnedProcessMember().equals(msg.getFeature())
         && isAccessible(SpemViewsRepository.ProcessComponent.Properties.ownedProcessMember))
       basePart.updateOwnedProcessMember();
   }
 }
  @Override
  protected void handleNotificationEvent(Notification notification) {
    super.handleNotificationEvent(notification);
    Object feature = notification.getFeature();
    if ((getModel() != null) && (getModel() == notification.getNotifier())) {
      if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
        refreshLineWidth();
      }
    }

    if (notification.getNewValue() instanceof EAnnotation
        && ARROW.equals(((EAnnotation) notification.getNewValue()).getSource())) {
      refreshArrowDirection((EAnnotation) notification.getNewValue());
    } else if (notification.getNotifier() instanceof EAnnotation
        && ARROW.equals(((EAnnotation) notification.getNotifier()).getSource())) {
      refreshArrowDirection(
          (EAnnotation) notification.getNotifier()); // notification.getEventType() ==
    }
  }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     ViewReferencePropertiesEditionPart basePart =
         (ViewReferencePropertiesEditionPart) editingPart;
     if (ViewsPackage.eINSTANCE.getViewElement_Name().equals(msg.getFeature())
         && basePart != null
         && isAccessible(ViewsViewsRepository.ViewReference.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
     if (ViewsPackage.eINSTANCE.getViewReference_View().equals(msg.getFeature())
         && basePart != null
         && isAccessible(ViewsViewsRepository.ViewReference.Properties.referencedView))
       basePart.setReferencedView((EObject) msg.getNewValue());
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     StatePropertiesEditionPart basePart = (StatePropertiesEditionPart) editingPart;
     if (StatemachinePackage.eINSTANCE.getState_Name().equals(msg.getFeature())
         && basePart != null
         && isAccessible(StatemachineViewsRepository.State.Properties.name)) {
       if (msg.getNewValue() != null) {
         basePart.setName(
             EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
       } else {
         basePart.setName("");
       }
     }
     if (StatemachinePackage.eINSTANCE.getState_Actions().equals(msg.getFeature())
         && isAccessible(StatemachineViewsRepository.State.Properties.actions))
       basePart.updateActions();
     if (StatemachinePackage.eINSTANCE.getState_Transitions().equals(msg.getFeature())
         && isAccessible(StatemachineViewsRepository.State.Properties.transitions))
       basePart.updateTransitions();
   }
 }