public UTinyCodePanel(IRegistry registry, UTinyModule.Reference mainModule, State state)
        {
            m_Registry   = registry;
            m_MainModule = mainModule;

            // Init tree
            if (null == state.TreeState)
            {
                state.TreeState = new UTinyCodeTreeState();
            }

            state.TreeState.Init(UTinyCodeTreeView.CreateMultiColumnHeaderState());
            m_TreeView = new UTinyCodeTreeView(state.TreeState, new UTinyCodeTreeModel(registry, mainModule))
            {
                HasContextMenu = true,
            };

            // Init code editors
            m_SystemEditorControl = new UTinySystemEditorControl(registry, mainModule);
            m_ScriptEditorControl = new UTinyScriptEditorControl(registry);

            // Register events
            m_TreeView.OnContextMenuEvent       += HandleContextMenuEvent;
            m_TreeView.OnRenameEnded            += HandleRenameEnded;
            m_SystemEditorControl.OnRenameEnded += HandleRenameEnded;
            m_ScriptEditorControl.OnRenameEnded += HandleRenameEnded;

            var leftPanel = new UTinyPanel();

            leftPanel.AddElement(CreateLeftToolbar());
            leftPanel.AddElement(m_TreeView);

            m_RightPanel = new UTinyPanel();
            m_RightPanel.AddElement(CreateRightToolbar());
            m_RightPanel.AddElement(m_SystemEditorControl);

            if (null == state.SeparatorState)
            {
                state.SeparatorState = new Separator.State();
            }

            var separator = new Separator(leftPanel, m_RightPanel, state.SeparatorState)
            {
                MinLeft  = 350,
                MinRight = 300
            };

            AddElement(separator);

            if (null != UTinySystemExecutionGraphWindow.Instance)
            {
                UTinySystemExecutionGraphWindow.Instance.Registry = m_Registry;
                UTinySystemExecutionGraphWindow.Instance.Module   = m_MainModule;
            }
        }
        public UTinyAssetPanel(IRegistry registry, UTinyProject.Reference project, UTinyModule.Reference mainModule, State state)
        {
            m_Registry   = registry;
            m_Project    = project;
            m_MainModule = mainModule;

            UnityEngine.Assertions.Assert.IsNotNull(state);

            if (null == state.TreeState)
            {
                state.TreeState = new UTinyAssetTreeState();
            }
            // @TODO Find a way to move this to the base class
            state.TreeState.Init(UTinyAssetTreeView.CreateMultiColumnHeaderState());

            m_TreeView = new UTinyAssetTreeView(state.TreeState, new UTinyAssetTreeModel(m_Registry, m_MainModule));

            m_AssetPreviewControl = new UTinyAssetPreviewControl(m_Registry, m_Project, m_MainModule);

            m_LeftPanel = new UTinyPanel();
            m_LeftPanel.AddElement(CreateLeftToolbar());
            m_LeftPanel.AddElement(m_TreeView);

            m_RightPanel = new UTinyPanel();
            m_RightPanel.AddElement(CreateRightToolbar());
            m_RightPanel.AddElement(m_AssetPreviewControl);

            if (null == state.SeparatorState)
            {
                state.SeparatorState = new Separator.State();
            }

            m_Separator = new Separator(m_LeftPanel, m_RightPanel, state.SeparatorState)
            {
                MinLeft  = 350,
                MinRight = 300
            };

            AddElement(m_Separator);
        }