@Override
  public IScriptDependency addDependency(IScriptDependency dependency) {
    /*
     * Find the list of dependencies for the object of the specified dependency
     */
    final EObject object = dependency.getObject();
    EList<IScriptDependency> dList = getDependencies().get(object);
    if (dList == null) {
      final BasicEMap.Entry<EObject, EList<IScriptDependency>> entry =
          (Entry<EObject, EList<IScriptDependency>>)
              IScriptEngineFactory.eINSTANCE.create(
                  IScriptEnginePackage.Literals.EOBJECT_TO_SCRIPT_DEPENDENCY_LIST_MAP_ENTRY);
      entry.setKey(object);
      getDependencies().add(entry);
      dList = entry.getValue();
      object.eAdapters().add(myDependencyAdapter);
    }

    /*
     * See if we have an identical entry of the list
     */
    for (final IScriptDependency d : dList) {
      if (d.equals(dependency)) return d;
    }
    dList.add(dependency);

    return dependency;
  }
 @Override
 public void pruneDependencies() {
   final Iterator<java.util.Map.Entry<EObject, EList<IScriptDependency>>> eIterator =
       getDependencies().entrySet().iterator();
   while (eIterator.hasNext()) {
     final java.util.Map.Entry<EObject, EList<IScriptDependency>> e = eIterator.next();
     final EList<IScriptDependency> dList = e.getValue();
     final Iterator<IScriptDependency> dIterator = dList.iterator();
     while (dIterator.hasNext()) {
       final IScriptDependency d = dIterator.next();
       if (!d.eIsSet(IScriptEnginePackage.Literals.SCRIPT_DEPENDENCY__EXPRESSIONS)) {
         dIterator.remove();
       }
     }
     if (dList.isEmpty()) {
       e.getKey().eAdapters().remove(myDependencyAdapter);
       eIterator.remove();
     }
   }
 }
  /**
   * Checks if any current {@link IScriptDependency} match the specified notification.
   *
   * <p>If one does match, all associated expressions are re-evaluated.
   *
   * @param msg the notification to check
   */
  protected void checkChangedDependencies(Notification msg) {
    final EList<IScriptDependency> dList = getDependencies().get(msg.getNotifier());

    /*
     * Should probably never happen!
     */
    if (dList == null) return;

    for (final IScriptDependency d : dList) {
      if (d.getFeature() != msg.getFeature()) {
        continue;
      }

      if (d.getIndex() != -1) {
        if (d.getIndex() != msg.getPosition()) {
          continue;
        }
      }

      if (d.getKey() != null) {
        // TODO
        LogUtils.debug(this, "key=" + d.getKey() + "\nmsg=" + ToStringUtils.toString(msg));
      }

      /*
       * We have a match...
       */
      for (final IScriptExpression e : d.getExpressions()) {
        IManagerRunnable.Factory.asyncExec(
            "evaluate",
            e,
            new Runnable() {
              @Override
              public void run() {
                e.evaluate();
              }
            });
      }
    }
  }