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

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

            return(window);
        }
Exemplo n.º 2
0
 void SetData(ProjectAuditorWindow projectAuditorWindow, TreeViewSelection selection, string[] names)
 {
     m_Names = names;
     m_ProjectAuditorWindow = projectAuditorWindow;
     CreateTable(projectAuditorWindow, selection);
 }
        void UpdateAssemblySelection()
        {
            if (m_AssemblyNames == null)
            {
                return;
            }

            if (m_AssemblySelection == null)
            {
                m_AssemblySelection = new TreeViewSelection();
            }

            m_AssemblySelection.selection.Clear();
            if (!string.IsNullOrEmpty(m_AssemblySelectionSummary))
            {
                if (m_AssemblySelectionSummary == "All")
                {
                    m_AssemblySelection.SetAll(m_AssemblyNames);
                }
                else if (m_AssemblySelectionSummary != "None")
                {
                    var assemblies = m_AssemblySelectionSummary.Split(new[] { ", " }, StringSplitOptions.None)
                                     .Where(assemblyName => m_AssemblyNames.Contains(assemblyName));
                    if (assemblies.Count() > 0)
                    {
                        foreach (var assembly in assemblies)
                        {
                            m_AssemblySelection.selection.Add(assembly);
                        }
                    }
                }
            }

            if (!m_AssemblySelection.selection.Any())
            {
                // initial selection setup:
                // - assemblies from user scripts or editable packages, or
                // - default assembly, or,
                // - all generated assemblies

                var compiledAssemblies = m_AssemblyNames.Where(a => !AssemblyHelper.IsModuleAssembly(a));
                compiledAssemblies = compiledAssemblies.Where(a =>
                                                              !AssemblyHelper.IsAssemblyReadOnly(a));
                m_AssemblySelection.selection.AddRange(compiledAssemblies);

                if (!m_AssemblySelection.selection.Any())
                {
                    if (m_AssemblyNames.Contains(AssemblyHelper.DefaultAssemblyName))
                    {
                        m_AssemblySelection.Set(AssemblyHelper.DefaultAssemblyName);
                    }
                    else
                    {
                        m_AssemblySelection.SetAll(m_AssemblyNames);
                    }
                }
            }

            // update assembly selection summary
            m_AssemblySelectionSummary = GetSelectedAssembliesSummary();
        }
 public void SetAreaSelection(TreeViewSelection selection)
 {
     m_AreaSelection = selection;
     RefreshDisplay();
 }
 public void SetAssemblySelection(TreeViewSelection selection)
 {
     m_AssemblySelection = selection;
     RefreshDisplay();
 }