void Initialize()
        {
            contextMenu         = new ContextMenu();
            panelContextMenu    = new ContextMenu();
            contextMenu.Opened += contextMenu_Opened;
            // Context menu:
            addComponentItem = EditorUtils.CreateMenuItem("Add Component", (ImageSource)FindResource("ComponentIcon"));
            MenuItem createObjectItem      = EditorUtils.CreateMenuItem("Create New Object...", (ImageSource)FindResource("GameObjectIcon_Sprite"));
            MenuItem panelCreateObjectItem = EditorUtils.CreateMenuItem("Create New Object...", (ImageSource)FindResource("GameObjectIcon_Sprite"));
            MenuItem addFromStateItem      = EditorUtils.CreateMenuItem("Add From State...", null);
            MenuItem panelAddFromStateItem = EditorUtils.CreateMenuItem("Add From State...", null);

            saveStateItem = EditorUtils.CreateMenuItem("Save State...", (ImageSource)FindResource("SaveIcon"));
            MenuItem cutItem        = EditorUtils.CreateMenuItem("Cut", (ImageSource)FindResource("CutIcon"));
            MenuItem copyItem       = EditorUtils.CreateMenuItem("Copy", (ImageSource)FindResource("CopyIcon"));
            MenuItem pasteItem      = EditorUtils.CreateMenuItem("Paste", (ImageSource)FindResource("PasteIcon"));
            MenuItem panelPasteItem = EditorUtils.CreateMenuItem("Paste", (ImageSource)FindResource("PasteIcon"));
            MenuItem deleteItem     = EditorUtils.CreateMenuItem("Delete", null);

            renameItem   = EditorUtils.CreateMenuItem("Rename", (ImageSource)FindResource("RenameIcon"));
            moveUpItem   = EditorUtils.CreateMenuItem("Move Up", (ImageSource)FindResource("MoveUpIcon"));
            moveDownItem = EditorUtils.CreateMenuItem("Move Down", (ImageSource)FindResource("MoveDownIcon"));

            contextMenu.Items.Add(addComponentItem);
            contextMenu.Items.Add(createObjectItem);
            contextMenu.Items.Add(new Separator());
            contextMenu.Items.Add(addFromStateItem);
            contextMenu.Items.Add(saveStateItem);
            contextMenu.Items.Add(new Separator());
            contextMenu.Items.Add(cutItem);
            contextMenu.Items.Add(copyItem);
            contextMenu.Items.Add(pasteItem);
            contextMenu.Items.Add(deleteItem);
            contextMenu.Items.Add(new Separator());
            contextMenu.Items.Add(renameItem);
            //contextMenu.Items.Add(new Separator());
            //contextMenu.Items.Add(moveUpItem);
            //contextMenu.Items.Add(moveDownItem);

            panelContextMenu.Items.Add(panelCreateObjectItem);
            panelContextMenu.Items.Add(new Separator());
            panelContextMenu.Items.Add(panelAddFromStateItem);
            panelContextMenu.Items.Add(new Separator());
            panelContextMenu.Items.Add(panelPasteItem);

            createObjectItem.Click += createObjectItem_Click;
            addFromStateItem.Click += addFromStateItem_Click;
            renameItem.Click       += renameItem_Click;
            saveStateItem.Click    += saveStateItem_Click;
            cutItem.Click          += cutItem_Click;
            copyItem.Click         += copyItem_Click;
            pasteItem.Click        += pasteItem_Click;
            deleteItem.Click       += deleteItem_Click;
            moveUpItem.Click       += moveUpItem_Click;
            moveDownItem.Click     += moveDownItem_Click;

            panelCreateObjectItem.Click += createObjectItem_Click;
            panelAddFromStateItem.Click += addFromStateItem_Click;
            panelPasteItem.Click        += panelPasteItem_Click;
        }
        void contextMenu_Opened(object sender, RoutedEventArgs e)
        {
            // check disabled :
            if (TreeViewExtension.GetSelectedTreeViewItems(treeView).Count > 1)
            {
                // more than one selected:
                renameItem.IsEnabled    = false;
                moveUpItem.IsEnabled    = false;
                moveDownItem.IsEnabled  = false;
                saveStateItem.IsEnabled = false;
            }
            else
            {
                renameItem.IsEnabled    = true;
                moveUpItem.IsEnabled    = true;
                moveDownItem.IsEnabled  = true;
                saveStateItem.IsEnabled = true;
            }

            addComponentItem.Items.Clear();
            GibboMenuItem item = null;

            if (SceneManager.ScriptsAssembly == null)
            {
                addComponentItem.Visibility = System.Windows.Visibility.Collapsed;
                return;
            }
            else
            {
                addComponentItem.Visibility = System.Windows.Visibility.Visible;

                //ObjectComponent dummy = new ObjectComponent();
                foreach (Type type in SceneManager.ScriptsAssembly.GetTypes())
                {
                    // is a game object component?
                    if (type.IsSubclassOf(typeof(ObjectComponent)))
                    {
                        string        fullname = type.FullName;
                        GibboMenuItem lastItem = addComponentItem;

                        if (fullname != type.Name && fullname.Contains('.'))
                        {
                            string[] splitted = fullname.Split('.');
                            int      scount   = splitted.Count() - 1;

                            for (int i = 0; i < scount; i++)
                            {
                                item = null;
                                string camelCaseFix = GibboHelper.SplitCamelCase(splitted[i]);

                                for (int j = 0; j < lastItem.Items.Count; j++)
                                {
                                    if ((lastItem.Items[j] as GibboMenuItem).TagText.Equals(camelCaseFix))
                                    {
                                        item = lastItem.Items[j] as GibboMenuItem;
                                        break;
                                    }
                                }

                                if (item == null)
                                {
                                    item         = EditorUtils.CreateMenuItem(camelCaseFix, null);
                                    item.TagText = camelCaseFix;
                                    lastItem.Items.Insert(0, item);
                                }

                                lastItem = item;
                            }
                        }

                        string        camelCase = GibboHelper.SplitCamelCase(type.Name);
                        GibboMenuItem newItem   = EditorUtils.CreateMenuItem(camelCase, (ImageSource)FindResource("ComponentItemIcon"));
                        newItem.Tag     = type;
                        newItem.TagText = camelCase;
                        newItem.Click  += newItem_Click;

                        SearchAndAttachInfo(newItem, type);

                        lastItem.Items.Add(newItem);
                    }
                }
            }

            // System Components :
            GibboMenuItem subItem;

            addComponentItem.Items.Add(new Separator());
            item = EditorUtils.CreateMenuItem("Physics");

            subItem         = EditorUtils.CreateMenuItem("Physical Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(PhysicalBody);
            subItem.TagText = typeof(PhysicalBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(PhysicalBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Rectangle Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(RectangleBody);
            subItem.TagText = typeof(RectangleBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(RectangleBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Circle Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(CircleBody);
            subItem.TagText = typeof(CircleBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(CircleBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Texture Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(TextureBody);
            subItem.TagText = typeof(TextureBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(TextureBody));

            item.Items.Add(subItem);

            addComponentItem.Items.Add(item);
        }