Exemple #1
0
 /// <inheritdoc />
 protected override void GenerateMenuItems(ref List <PopupMenuItem> rootItems, ref Dictionary <string, PopupMenuItem> groupsByLabel, ref Dictionary <string, PopupMenuItem> itemsByLabel)
 {
     for (int n = items.Length - 1; n >= 0; n--)
     {
         var item = items[n];
         PopupMenuUtility.BuildPopupMenuItemWithLabel(ref rootItems, ref groupsByLabel, ref itemsByLabel, n, null, item, "", null);
     }
 }
Exemple #2
0
        private static void SetupThreaded(object threadTaskId)
        {
                        #if DEV_MODE
            var timer = new ExecutionTimeLogger();
            timer.Start("MemberInfoBaseDrawerData.SetupThreaded");
            timer.StartInterval("Generate PopupMenuItems");
                        #endif

            var sb = new System.Text.StringBuilder();
            foreach (var type in TypeExtensions.AllVisibleAndUniqueTypes)
            {
                sb.Append(TypeExtensions.GetPopupMenuLabel(type, ""));
                sb.Append('/');
                string typePrefix = sb.ToString();
                sb.Length = 0;

                var fields = type.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                for (int f = fields.Length - 1; f >= 0; f--)
                {
                    var field = fields[f];
                    sb.Append(typePrefix);
                    sb.Append(field.Name);
                    string menuPath = sb.ToString();
                    sb.Length = 0;
                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref fieldRootItems, ref fieldGroupsByLabel, ref fieldItemsByLabel, field, menuPath, MenuItemValueType.Undefined);
                }

                var properties = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                for (int p = properties.Length - 1; p >= 0; p--)
                {
                    var property = properties[p];
                    sb.Append(typePrefix);
                    StringUtils.ToString(property, sb);

                    string menuPath = sb.ToString();
                    sb.Length = 0;
                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref propertyRootItems, ref propertyGroupsByLabel, ref propertyItemsByLabel, property, menuPath, MenuItemValueType.Undefined);
                }

                var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);

                for (int m = methods.Length - 1; m >= 0; m--)
                {
                    var method = methods[m];

                    sb.Append(typePrefix);
                    StringUtils.ToString(method, sb);
                    string menuPath = sb.ToString();
                    sb.Length = 0;

                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref methodRootItems, ref methodGroupsByLabel, ref methodItemsByLabel, method, menuPath, MenuItemValueType.Undefined);
                }
            }

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("allRootItems.AddRange(fieldRootItems)");
                        #endif

            allRootItems.AddRange(fieldRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allRootItems, propertyRootItems)");
                        #endif

            PopupMenuUtility.AddRange(ref allRootItems, propertyRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allRootItems, methodRootItems)");
                        #endif

            PopupMenuUtility.AddRange(ref allRootItems, methodRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, fieldGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, fieldGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, propertyGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, propertyGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, methodGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, methodGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, fieldItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, fieldItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, propertyItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, propertyItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, methodItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, methodItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.FinishAndLogResults();
                        #endif

            setupDone = SetupPhase.Done;

            lock (threadLock)
            {
                var action = onSetupFinished;
                if (action != null)
                {
                    onSetupFinished = null;
                    action();
                }
            }
        }