public static AreaSelectionWindow Open(float screenX, float screenY, ProjectAuditorWindow projectAuditorWindow,
                                               TreeViewSelection selection, string[] names)
        {
            var window = GetWindow <AreaSelectionWindow>("Areas");

            window.position = new Rect(screenX, screenY, 400, 500);
            window.SetData(projectAuditorWindow, selection, names);
            window.Show();

            return(window);
        }
        void CreateTable(ProjectAuditorWindow projectAuditorWindow, TreeViewSelection selection, string[] names)
        {
            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            MultiSelectionTable.HeaderData[] headerData =
            {
                new MultiSelectionTable.HeaderData("Area",                                                                                   "Area Name", 350,   100, true, false),
                new MultiSelectionTable.HeaderData("Show",
                                                   "Check to show issues affecting this area in the analysis views",                                  40, 100, false, false),
                new MultiSelectionTable.HeaderData("Group",                                                                                  "Group",     100,   100, true, false)
            };
            m_MultiColumnHeaderState = MultiSelectionTable.CreateDefaultMultiColumnHeaderState(headerData);

            var multiColumnHeader = new MultiColumnHeader(m_MultiColumnHeaderState);

            multiColumnHeader.SetSorting((int)MultiSelectionTable.MyColumns.ItemName, true);
            multiColumnHeader.ResizeToFit();
            m_AreaTable = new MultiSelectionTable(m_TreeViewState, multiColumnHeader, names, selection);
        }
        void CreateTable(ProjectAuditorWindow projectAuditorWindow, TreeViewSelection selection)
        {
            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            MultiSelectionTable.HeaderData[] headerData =
            {
                new MultiSelectionTable.HeaderData("Assembly",    "Assembly Name",                                     350, 100, true, false),
                new MultiSelectionTable.HeaderData("Show",        "Check to show this assembly in the analysis views",  40, 100,
                                                   false,         false),
                new MultiSelectionTable.HeaderData("Group",       "Assembly Group",                                    100, 100, true, false)
            };
            m_MultiColumnHeaderState = MultiSelectionTable.CreateDefaultMultiColumnHeaderState(headerData);

            var multiColumnHeader = new MultiColumnHeader(m_MultiColumnHeaderState);

            multiColumnHeader.SetSorting((int)MultiSelectionTable.Column.ItemName, true);
            multiColumnHeader.ResizeToFit();
            m_MultiSelectionTable = new MultiSelectionTable(m_TreeViewState, multiColumnHeader, m_Names, selection);
        }
 void SetData(ProjectAuditorWindow projectAuditorWindow, TreeViewSelection selection, string[] names)
 {
     m_ProjectAuditorWindow = projectAuditorWindow;
     CreateTable(projectAuditorWindow, selection, names);
 }
        void OnEnable()
        {
            var currentState = m_AnalysisState;

            m_AnalysisState = AnalysisState.Initializing;

            ProjectAuditorAnalytics.EnableAnalytics();

            m_ProjectAuditor = new ProjectAuditor();

            UpdateAreaSelection();
            UpdateAssemblySelection();

            if (m_TextFilter == null)
            {
                m_TextFilter = new TextFilter();
            }

            var viewDescriptors = ViewDescriptor.GetAll();

            Array.Sort(viewDescriptors, (a, b) => a.menuOrder.CompareTo(b.menuOrder));

            m_ViewDropdownItems = new Utility.DropdownItem[viewDescriptors.Length];
            m_Views             = new AnalysisView[viewDescriptors.Length];
            for (int i = 0; i < viewDescriptors.Length; i++)
            {
                var desc        = viewDescriptors[i];
                var layout      = m_ProjectAuditor.GetLayout(desc.category);
                var isSupported = layout != null;

                m_ViewDropdownItems[i] = new Utility.DropdownItem
                {
                    Content          = new GUIContent(string.IsNullOrEmpty(desc.menuLabel) ? desc.name : desc.menuLabel),
                    SelectionContent = new GUIContent("View: " + desc.name),
                    Enabled          = isSupported
                };

                if (!isSupported)
                {
                    Debug.Log("Project Auditor module " + desc.category + " is not supported.");
                    continue;
                }

                var view = desc.viewType != null ? (AnalysisView)Activator.CreateInstance(desc.viewType) : new AnalysisView();
                view.Create(desc, layout, m_ProjectAuditor.config, m_Preferences, this);

                if (currentState == AnalysisState.Valid)
                {
                    view.AddIssues(m_ProjectReport.GetIssues(desc.category));
                }

                m_Views[i] = view;
            }

            if (currentState != AnalysisState.Valid)
            {
                m_ProjectReport = new ProjectReport();
            }

            AnalysisView.SetReport(m_ProjectReport);
            AnalysisView.OnChangeView = SelectView;

            GetView <ShaderVariantsView>().SetShadersAuditor(m_ProjectAuditor.GetAuditor <ShadersAuditor>());

            // are we reloading from a valid state?
            if (currentState == AnalysisState.Valid && m_ActiveViewIndex < viewDescriptors.Length)
            {
                m_AnalysisState = currentState;
            }
            else
            {
                m_AnalysisState = AnalysisState.Initialized;
            }

            RefreshDisplay();

            Instance = this;
        }