private void CellGUI(Rect cellRect, UTinySystemTreeViewItem item, ColumnType columnType, ref RowGUIArgs args)
        {
            CenterRectUsingSingleLineHeight(ref cellRect);

            using (new GUIEnabledScope(item.Editable))
            {
                var system = item.System.Dereference(Model.Registry);
                switch (columnType)
                {
                case ColumnType.Icon:
                {
                    GUI.DrawTexture(cellRect, null == system ? UTinyIcons.Warning : UTinyIcons.System, ScaleMode.ScaleToFit);
                }
                break;

                case ColumnType.Name:
                {
                    var toggleRect = cellRect;
                    toggleRect.x    += 8;
                    toggleRect.width = 18;
                    item.Schedule    = EditorGUI.Toggle(toggleRect, item.Schedule);
                    args.rowRect     = cellRect;
                    base.RowGUI(args);
                }
                break;

                case ColumnType.Module:
                {
                    GUI.Label(cellRect, item.Module.Name);
                }
                break;
                }
            }
        }
        protected override TreeViewItem BuildRoot()
        {
            Model.ClearIds();

            var root = new TreeViewItem {
                id = 0, depth = -1
            };

            var systems = Model.GetSystems();

            foreach (var systemReference in systems)
            {
                var system = systemReference.Dereference(Model.Registry);

                var module          = UTinyUtility.GetModules(Model.Registry, systemReference).FirstOrDefault();
                var moduleReference = null != module ? (UTinyModule.Reference)module : UTinyModule.Reference.None;
                var editable        = moduleReference.Id == Model.MainModule.Id;

                if (system != null)
                {
                    if (!State.FilterSystems)
                    {
                        continue;
                    }

                    if (!editable && State.FilterProjectOnly)
                    {
                        continue;
                    }
                }

                var item = new UTinySystemTreeViewItem(Model.Registry, Model.MainModule, moduleReference, systemReference)
                {
                    id       = GenerateInstanceId(systemReference),
                    Editable = editable
                };

                root.AddChild(item);
            }

            var scripts = Model.GetScripts();

            foreach (var scriptReference in scripts)
            {
                var script = scriptReference.Dereference(Model.Registry);

                var module          = UTinyUtility.GetModules(Model.Registry, scriptReference).FirstOrDefault();
                var moduleReference = null != module ? (UTinyModule.Reference)module : UTinyModule.Reference.None;
                var editable        = moduleReference.Id == Model.MainModule.Id;

                if (script != null)
                {
                    if (!State.FilterScripts)
                    {
                        continue;
                    }

                    if (!editable && State.FilterProjectOnly)
                    {
                        continue;
                    }
                }

                var item = new UTinyScriptTreeViewItem(Model.Registry, Model.MainModule, moduleReference, scriptReference)
                {
                    id       = GenerateInstanceId(scriptReference),
                    Editable = editable
                };

                root.AddChild(item);
            }

            return(root);
        }