public void Initialize(List <Object> objects, HashSet <Object> favoriteObjects, Object mainObject, SortType sortType, ObjectClickedDelegate onObjectLeftClicked, ObjectClickedDelegate onObjectRightClicked, ObjectClickedDelegate onObjectRemoved, FavoriteStateChangedDelegate onObjectFavoriteStateChanged, WindowClosedDelegate onWindowClosed)
        {
            this.objects                      = objects;
            this.favoriteObjects              = favoriteObjects;
            this.mainObject                   = mainObject;
            this.sortType                     = sortType;
            this.onObjectLeftClicked          = onObjectLeftClicked;
            this.onObjectRightClicked         = onObjectRightClicked;
            this.onObjectRemoved              = onObjectRemoved;
            this.onObjectFavoriteStateChanged = onObjectFavoriteStateChanged;
            this.onWindowClosed               = onWindowClosed;

            addToFavoritesIcon      = new GUIContent(EditorGUIUtility.Load("Favorite Icon") as Texture, "Add to Favorites");
            removeFromFavoritesIcon = new GUIContent(addToFavoritesIcon.image, "Remove from Favorites");

            SortObjects();
        }
 private void OnDestroy()
 {
     try
     {
         if (onWindowClosed != null)
         {
             onWindowClosed(sortType);
         }
     }
     finally
     {
         objects                      = null;
         favoriteObjects              = null;
         mainObject                   = null;
         buttonStyle                  = null;
         addToFavoritesIcon           = null;
         removeFromFavoritesIcon      = null;
         onObjectLeftClicked          = null;
         onObjectRightClicked         = null;
         onObjectRemoved              = null;
         onObjectFavoriteStateChanged = null;
         onWindowClosed               = null;
     }
 }