Example #1
0
    @Override
    public void unsetTarget(Notifier oldTarget) {
      if (oldTarget == getResourceSet()) {
        for (Resource next : getResourceSet().getResources()) {
          unadapt(next);
        }
      }

      super.unsetTarget(oldTarget);
    }
 @Override
 public void notifyChanged(Notification msg) {
   if (msg.getFeature().equals(ScaPackage.eINSTANCE.getComposite_Name())) {
     refresh();
   } else if (msg.getFeature().equals(ScaPackage.eINSTANCE.getComponent_Name())) {
     refresh();
   } else {
     refresh();
   }
   super.notifyChanged(msg);
 }
Example #3
0
  @Override
  public void setTarget(Notifier newTarget) {
    // Don't need to track resources as targets (there are multiple)
    if (newTarget instanceof ResourceSet) {
      super.setTarget(newTarget);

      // Discover existing resources. Iterate the current set; any new additions
      // will be discovered automatically
      for (Resource next : ImmutableList.copyOf(((ResourceSet) newTarget).getResources())) {
        handleResourceAdded(next);
        if (next.isLoaded()) {
          handleResourceLoaded(next);
        }
      }
    }
  }
Example #4
0
 @Override
 public void notifyChanged(Notification notification) {
   final Map<URI, Resource> map = getURIResourceMap();
   if (map != null
       && notification.getFeatureID(Resource.class) == Resource.RESOURCE__URI
       && notification.getNotifier() instanceof Resource) {
     URI oldOne = (URI) notification.getOldValue();
     map.remove(oldOne);
     if (oldOne != null) {
       URI oldNormalized = getURIConverter().normalize(oldOne);
       if (!oldOne.equals(oldNormalized)) map.remove(oldNormalized);
     }
     Resource resource = (Resource) notification.getNotifier();
     registerURI(resource);
   }
   super.notifyChanged(notification);
 }
Example #5
0
    @Override
    public void setTarget(Notifier newTarget) {
      if ((newTarget == null) || (newTarget instanceof ResourceSet)) {
        super.setTarget(newTarget);
      }

      if (newTarget instanceof ResourceSet) {
        // Iterate a defensive copy because other adapters cause concurrent additions by loading
        // additional resources
        for (Resource next : ImmutableList.copyOf(((ResourceSet) newTarget).getResources())) {
          adapt(next);
        }
      } else if (newTarget instanceof Resource) {
        Resource resource = (Resource) newTarget;
        if (resource.isLoaded()) {
          // already loaded? Handled it
          handleResourceLoaded(resource);
        }
      }
    }
 public void notifyChanged(Notification msg) {
   super.notifyChanged(msg);
   notifyListeners(this, null);
 }
 /* (non-Javadoc)
  * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification)
  */
 public void notifyChanged(Notification msg) {
   super.notifyChanged(msg);
 }