Пример #1
0
            private void NotifyListeners(IResource parent, Operation op, IResource res, IPropertyChangeSet cs)
            {
                lock ( _listeners )
                {
                    ArrayList listenerList = (ArrayList)_listeners [parent.Id];
                    if (listenerList != null)
                    {
                        for (int i = 0; i < listenerList.Count; i++)
                        {
                            IResourceListListener listener = (IResourceListListener)listenerList [i];
                            switch (op)
                            {
                            case Operation.Added:
                                listener.ResourceAdded(res);
                                break;

                            case Operation.Changed:
                                listener.ResourceChanged(res, cs);
                                break;

                            case Operation.Deleting:
                                listener.ResourceDeleting(res);
                                break;
                            }
                        }
                    }
                }
            }
Пример #2
0
 public void UnregisterListener(IResource parent, IResourceListListener listener)
 {
     lock ( _listeners )
     {
         ArrayList listenerList = (ArrayList)_listeners [parent.Id];
         if (listenerList != null)
         {
             listenerList.Remove(listener);
         }
     }
 }
Пример #3
0
 public void RegisterListener(IResource parent, IResourceListListener listener)
 {
     lock ( _listeners )
     {
         ArrayList listenerList = (ArrayList)_listeners [parent.Id];
         if (listenerList == null)
         {
             listenerList           = new ArrayList();
             _listeners [parent.Id] = listenerList;
         }
         listenerList.Add(listener);
     }
 }
Пример #4
0
        public void UnregisterTreeListener(IResource parent, int parentProp, IResourceListListener listener)
        {
            TreeListenerManager manager;

            lock ( _treeListenerManagers )
            {
                manager = (TreeListenerManager)_treeListenerManagers [parentProp];
            }
            if (manager != null)
            {
                manager.UnregisterListener(parent, listener);
            }
        }
Пример #5
0
        public void RegisterTreeListener(IResource parent, int parentProp, IResourceListListener listener)
        {
            TreeListenerManager manager;

            lock ( _treeListenerManagers )
            {
                manager = (TreeListenerManager)_treeListenerManagers [parentProp];
                if (manager == null)
                {
                    manager = new TreeListenerManager(parentProp);
                    _treeListenerManagers [parentProp] = manager;
                }
            }
            manager.RegisterListener(parent, listener);
        }