private void SetupFilterTabsMenu()
        {
            filterTabsMenu.menu.MenuItems().Clear();
            filterTabsMenu.ShowTextTooltipOnSizeChange(-16);

            filterTabsMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.All), a =>
            {
                SetFilterFromMenu(PackageFilterTab.All);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.All ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterTabsMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.InProject), a =>
            {
                SetFilterFromMenu(PackageFilterTab.InProject);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.InProject ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterTabsMenu.menu.AppendSeparator();
            filterTabsMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.AssetStore), a =>
            {
                SetFilterFromMenu(PackageFilterTab.AssetStore);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.AssetStore ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterTabsMenu.menu.AppendSeparator();
            filterTabsMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.BuiltIn), a =>
            {
                SetFilterFromMenu(PackageFilterTab.BuiltIn);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.BuiltIn ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnFilterMenuCreate(filterTabsMenu.menu);
                }
            });
        }
        private void SetupAdvancedMenu()
        {
            AdvancedMenu.menu.AppendAction("Reset Packages to defaults", a =>
            {
                EditorApplication.ExecuteMenuItem(ApplicationUtil.ResetPackagesMenuPath);
            }, a => DropdownMenuAction.Status.Normal);

            AdvancedMenu.menu.AppendAction("Show dependencies", a =>
            {
                ToggleDependencies();
            }, a => PackageManagerPrefs.ShowPackageDependencies ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            AdvancedMenu.menu.AppendAction("Show preview packages", a =>
            {
                TogglePreviewPackages();
            }, a => PackageManagerPrefs.ShowPreviewPackages ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnAdvancedMenuCreate(AdvancedMenu.menu);
                }
            });
        }
Esempio n. 3
0
            private void OnProcessRemoveResult(RemoveRequest request)
            {
                var installedPackage = GetInstalledPackageInfo(request.PackageIdOrName);

                if (installedPackage == null)
                {
                    return;
                }
                m_InstalledPackageInfos.Remove(installedPackage.name);
                OnPackageInfosUpdated(new PackageInfo[] { installedPackage });

                PackageManagerExtensions.ExtensionCallback(() =>
                {
                    foreach (var extension in PackageManagerExtensions.Extensions)
                    {
                        extension.OnPackageRemoved(installedPackage);
                    }
                });

                if (IsPreviewInstalled(installedPackage))
                {
                    OnInstalledPreviewPackagesChanged();
                }

                // do a list offline to refresh all the dependencies
                List(true);
            }
        private void SetupAdvancedMenu()
        {
            advancedMenu.menu.AppendAction("Reset Packages to defaults", a =>
            {
                EditorApplication.ExecuteMenuItem(ApplicationUtil.k_ResetPackagesMenuPath);
                PageManager.instance.Refresh(RefreshOptions.UpmListOffline);
                PackageManagerWindowAnalytics.SendEvent("resetToDefaults");
            }, a => DropdownMenuAction.Status.Normal);

            advancedMenu.menu.AppendAction("Show dependencies", a =>
            {
                ToggleDependencies();
                PackageManagerWindowAnalytics.SendEvent("toggleDependencies");
            }, a => PackageManagerPrefs.instance.showPackageDependencies ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            advancedMenu.menu.AppendAction("Show preview packages", a =>
            {
                TogglePreviewPackages();
                PackageManagerWindowAnalytics.SendEvent("togglePreview");
            }, a => PackageManagerPrefs.instance.showPreviewPackages ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnAdvancedMenuCreate(advancedMenu.menu);
                }
            });
        }
        private void SetupAddMenu()
        {
            addMenu.menu.AppendAction("Add package from disk...", a =>
            {
                var path = EditorUtility.OpenFilePanelWithFilters("Select package on disk", "", new[] { "package.json file", "json" });
                if (Path.GetFileName(path) != "package.json")
                {
                    Debug.Log("Please select a valid package.json file in a package folder.");
                    return;
                }
                if (!string.IsNullOrEmpty(path) && !PackageDatabase.instance.isInstallOrUninstallInProgress)
                {
                    PackageDatabase.instance.InstallFromPath(Path.GetDirectoryName(path));
                    PackageManagerWindowAnalytics.SendEvent("addFromDisk");
                }
            }, a => DropdownMenuAction.Status.Normal);

            addMenu.menu.AppendAction("Add package from tarball...", a =>
            {
                var path = EditorUtility.OpenFilePanelWithFilters("Select package on disk", "", new[] { "Package tarball", "tgz" });
                if (!string.IsNullOrEmpty(path) && !PackageDatabase.instance.isInstallOrUninstallInProgress)
                {
                    PackageDatabase.instance.InstallFromPath(path);
                    PackageManagerWindowAnalytics.SendEvent("addFromTarball");
                }
            }, a => DropdownMenuAction.Status.Normal);

            addMenu.menu.AppendAction("Add package from git URL...", a =>
            {
                var addFromGitUrl            = new PackagesAction("Add");
                addFromGitUrl.actionClicked += url =>
                {
                    addFromGitUrl.Hide();
                    if (!PackageDatabase.instance.isInstallOrUninstallInProgress)
                    {
                        PackageDatabase.instance.InstallFromUrl(url);
                        PackageManagerWindowAnalytics.SendEvent("addFromGitUrl");
                    }
                };

                parent.Add(addFromGitUrl);
                addFromGitUrl.Show();
            }, a => DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnAddMenuCreate(addMenu.menu);
                }
            });
        }
        void RefreshExtensions(PackageInfo packageInfo)
        {
            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageSelectionChange(packageInfo?.Info);
                }

                foreach (var extension in PackageManagerExtensions.ToolbarExtensions)
                {
                    extension.OnPackageSelectionChange(packageInfo, PackageToolbarContainer);
                }
            });
        }
Esempio n. 7
0
        void RefreshExtensions(IPackageVersion version)
        {
            var packageInfo = version?.packageInfo;

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageSelectionChange(packageInfo);
                }

                foreach (var extension in PackageManagerExtensions.ToolbarExtensions)
                {
                    extension.OnPackageSelectionChange(version, packageToolbarContainer);
                }
            });
        }
Esempio n. 8
0
        private void OnProcessAddResult(Request <PackageInfo> request)
        {
            var packageInfo = request.Result;

            m_UpmCache.SetInstalledPackageInfo(packageInfo);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageAddedOrUpdated(packageInfo);
                }
            });

            // do a list offline to refresh all the dependencies
            List(true);
        }
        private void OnRemoveOperationSuccess(PackageInfo packageInfo)
        {
            if (package != null && package.RemoveSignal.Operation != null)
            {
                package.RemoveSignal.Operation.OnOperationSuccess -= OnRemoveOperationSuccess;
                package.RemoveSignal.Operation.OnOperationError   -= OnRemoveOperationError;
                package.RemoveSignal.Operation = null;
            }

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageRemoved(packageInfo.Info);
                }
            });
        }
        private void SetupFilterMenu()
        {
            filterMenu.menu.MenuItems().Clear();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.All), a =>
            {
                SetFilterFromMenu(PackageFilterTab.All);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.All ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.InProject), a =>
            {
                SetFilterFromMenu(PackageFilterTab.InProject);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.InProject ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.InDevelopment), a =>
            {
                SetFilterFromMenu(PackageFilterTab.InDevelopment);
            }, a =>
            {
                if (!HasPackageInDevelopment)
                {
                    return(DropdownMenuAction.Status.Hidden);
                }

                return(PackageFiltering.instance.currentFilterTab == PackageFilterTab.InDevelopment ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);
            });

            filterMenu.menu.AppendSeparator();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.AssetStore), a =>
            {
                SetFilter(PackageFilterTab.AssetStore);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.AssetStore ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendSeparator();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.BuiltIn), a =>
            {
                SetFilterFromMenu(PackageFilterTab.BuiltIn);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.BuiltIn ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnFilterMenuCreate(filterMenu.menu);
                }
            });
        }
        private void SetupFilterMenu(bool?showInDevelopment = null)
        {
            filterMenu.menu.MenuItems().Clear();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.All), a =>
            {
                SetFilterFromMenu(PackageFilterTab.All);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.All ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.Local), a =>
            {
                SetFilterFromMenu(PackageFilterTab.Local);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.Local ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendSeparator();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.Modules), a =>
            {
                SetFilterFromMenu(PackageFilterTab.Modules);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.Modules ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            filterMenu.menu.AppendSeparator();
            filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.AssetStore), a =>
            {
                SetFilter(PackageFilterTab.AssetStore);
            }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.AssetStore ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            var addInDevelopmentMenu = showInDevelopment ?? PackageDatabase.instance.allPackages.Any(p => p.installedVersion?.HasTag(PackageTag.InDevelopment) ?? false);

            if (addInDevelopmentMenu)
            {
                filterMenu.menu.AppendSeparator();
                filterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilterTab.InDevelopment), a =>
                {
                    SetFilterFromMenu(PackageFilterTab.InDevelopment);
                }, a => PackageFiltering.instance.currentFilterTab == PackageFilterTab.InDevelopment ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);
            }

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnFilterMenuCreate(filterMenu.menu);
                }
            });
        }
Esempio n. 12
0
        public PackageDetails()
        {
            var root = Resources.GetTemplate("PackageDetails.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    customContainer.Add(extension.CreateExtensionUI());
                }
            });

            root.StretchToParentSize();

            SetContentVisibility(false);
            SetUpdateVisibility(false);
            developButton.visible  = false;
            removeButton.visible   = false;
            importButton.visible   = false;
            downloadButton.visible = false;

            developButton.clickable.clicked    += DevelopClick;
            detailAuthorLink.clickable.clicked += AuthorClick;
            updateButton.clickable.clicked     += UpdateClick;
            removeButton.clickable.clicked     += RemoveClick;
            importButton.clickable.clicked     += ImportClick;
            downloadButton.clickable.clicked   += DownloadOrCancelClick;
            detailDescMore.clickable.clicked   += DescMoreClick;
            detailDescLess.clickable.clicked   += DescLessClick;

            detailDesc.RegisterCallback <GeometryChangedEvent>(DescriptionGeometryChangeEvent);

            var editManifestIconButton = new IconButton(Resources.GetIconPath("edit"));

            editManifestIconButton.clickable.clicked += EditPackageManifestClick;
            editPackageManifestButton.Add(editManifestIconButton);

            GetTagLabel(PackageTag.Verified).text = ApplicationUtil.instance.shortUnityVersion + " verified";
        }
        public PackageDetails()
        {
            var root = Resources.GetTemplate("PackageDetails.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    customContainer.Add(extension.CreateExtensionUI());
                }
            });

            root.StretchToParentSize();

            SetContentVisibility(false);
            SetUpdateVisibility(false);
            removeButton.visible   = false;
            importButton.visible   = false;
            downloadButton.visible = false;

            detailAuthorLink.clickable.clicked += AuthorClick;
            updateButton.clickable.clicked     += UpdateClick;
            removeButton.clickable.clicked     += RemoveClick;
            importButton.clickable.clicked     += ImportClick;
            downloadButton.clickable.clicked   += DownloadOrCancelClick;
            detailDescMore.clickable.clicked   += DescMoreClick;
            detailDescLess.clickable.clicked   += DescLessClick;

            detailDesc.RegisterCallback <GeometryChangedEvent>(DescriptionGeometryChangeEvent);
            detailImages?.RegisterCallback <GeometryChangedEvent>(ImagesGeometryChangeEvent);

            GetTagLabel(PackageTag.Verified.ToString()).text = string.Format(ApplicationUtil.instance.GetTranslationForText("{0} verified"), ApplicationUtil.instance.shortUnityVersion);

            root.Query <TextField>().ForEach(t =>
            {
                t.isReadOnly = true;
            });
        }
Esempio n. 14
0
        public PackageDetails()
        {
            root = Resources.GetTemplate("PackageDetails.uxml");
            Add(root);

            Cache = new VisualElementCache(root);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    CustomContainer.Add(extension.CreateExtensionUI());
                }
            });

            root.StretchToParentSize();

            SetContentVisibility(false);
            SetUpdateVisibility(false);
            DevelopButton.visible = false;
            RemoveButton.visible  = false;
            UpdateBuiltIn.visible = false;

            DevelopButton.clickable.clicked       += DevelopClick;
            UpdateButton.clickable.clicked        += UpdateClick;
            UpdateBuiltIn.clickable.clicked       += UpdateClick;
            RemoveButton.clickable.clicked        += RemoveClick;
            ViewDocButton.clickable.clicked       += ViewDocClick;
            ViewChangelogButton.clickable.clicked += ViewChangelogClick;
            ViewLicenses.clickable.clicked        += ViewLicensesClick;

            var editManifestIconButton = new IconButton(Resources.GetIconPath("edit"));

            editManifestIconButton.clickable.clicked += EditPackageManifestClick;
            EditPackageManifestButton.Add(editManifestIconButton);

            RegisterCallback <AttachToPanelEvent>(OnEnterPanel);
            RegisterCallback <DetachFromPanelEvent>(OnLeavePanel);

            UnityEditor.Selection.selectionChanged += OnEditorSelectionChanged;
        }
Esempio n. 15
0
        private void OnProcessRemoveResult(RemoveRequest request)
        {
            var installedPackage = m_UpmCache.GetInstalledPackageInfo(request.PackageIdOrName);

            if (installedPackage == null)
            {
                return;
            }
            m_UpmCache.RemoveInstalledPackageInfo(installedPackage.name);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageRemoved(installedPackage);
                }
            });

            // do a list offline to refresh all the dependencies
            List(true);
        }
Esempio n. 16
0
        private void OnAddOperationSuccess(PackageInfo packageInfo)
        {
            if (package != null && package.AddSignal.Operation != null)
            {
                package.AddSignal.Operation.OnOperationSuccess -= OnAddOperationSuccess;
                package.AddSignal.Operation.OnOperationError   -= OnAddOperationError;
                package.AddSignal.Operation = null;
            }

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    extension.OnPackageAddedOrUpdated(packageInfo.Info);
                }
            });

            Selection.SetSelection(packageInfo);
            foreach (var itemState in Selection.States.Where(p => p.PackageId == packageInfo.PackageId))
            {
                itemState.Expanded = false;
            }
        }
Esempio n. 17
0
        public PackageDetails()
        {
            var root = Resources.GetTemplate("PackageDetails.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    customContainer.Add(extension.CreateExtensionUI());
                }
            });

            root.StretchToParentSize();

            SetContentVisibility(false);
            SetUpdateVisibility(false);
            developButton.visible = false;
            removeButton.visible  = false;

            developButton.clickable.clicked       += DevelopClick;
            updateButton.clickable.clicked        += UpdateClick;
            removeButton.clickable.clicked        += RemoveClick;
            viewDocButton.clickable.clicked       += ViewDocClick;
            viewChangelogButton.clickable.clicked += ViewChangelogClick;
            viewLicensesButton.clickable.clicked  += ViewLicensesClick;

            var editManifestIconButton = new IconButton(Resources.GetIconPath("edit"));

            editManifestIconButton.clickable.clicked += EditPackageManifestClick;
            editPackageManifestButton.Add(editManifestIconButton);

            GetTagLabel(PackageTag.Verified).text = ApplicationUtil.instance.shortUnityVersion + " verified";
        }
Esempio n. 18
0
            private void OnProcessAddResult(Request <PackageInfo> request)
            {
                var packageInfo    = request.Result;
                var oldPackageInfo = GetInstalledPackageInfo(packageInfo.name);

                m_InstalledPackageInfos[packageInfo.name] = packageInfo;
                OnPackageInfosUpdated(new PackageInfo[] { packageInfo });

                PackageManagerExtensions.ExtensionCallback(() =>
                {
                    foreach (var extension in PackageManagerExtensions.Extensions)
                    {
                        extension.OnPackageAddedOrUpdated(packageInfo);
                    }
                });

                if (IsPreviewInstalled(packageInfo) || IsPreviewInstalled(oldPackageInfo))
                {
                    OnInstalledPreviewPackagesChanged();
                }

                // do a list offline to refresh all the dependencies
                List(true);
            }
        private void SetupFilterMenu()
        {
            FilterMenu.menu.MenuItems().Clear();

            FilterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilter.All), a =>
            {
                SetFilter(PackageFilter.All);
            }, a => selectedFilter == PackageFilter.All ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            FilterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilter.Local), a =>
            {
                SetFilter(PackageFilter.Local);
            }, a => selectedFilter == PackageFilter.Local ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);

            FilterMenu.menu.AppendSeparator();
            FilterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilter.Modules), a =>
            {
                SetFilter(PackageFilter.Modules);
            }, a => selectedFilter == PackageFilter.Modules ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);
            if (Collection != null && Collection.AnyPackageInDevelopment)
            {
                FilterMenu.menu.AppendSeparator();
                FilterMenu.menu.AppendAction(GetFilterDisplayName(PackageFilter.InDevelopment), a =>
                {
                    SetFilter(PackageFilter.InDevelopment);
                }, a => selectedFilter == PackageFilter.InDevelopment ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);
            }

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnFilterMenuCreate(FilterMenu.menu);
                }
            });
        }
        private void SetupAddMenu()
        {
            addMenu.menu.AppendAction("Add package from disk...", a =>
            {
                var path = EditorUtility.OpenFilePanelWithFilters("Select package on disk", "", new[] { "package.json file", "json" });
                if (!string.IsNullOrEmpty(path) && !PackageDatabase.instance.isInstallOrUninstallInProgress)
                {
                    PackageDatabase.instance.InstallFromPath(path);
                }
            }, a => DropdownMenuAction.Status.Normal);

            addMenu.menu.AppendAction("Add package from git URL...", a =>
            {
                var addFromGitUrl            = new PackagesAction("Add");
                addFromGitUrl.actionClicked += url =>
                {
                    addFromGitUrl.Hide();
                    if (!PackageDatabase.instance.isInstallOrUninstallInProgress)
                    {
                        PackageDatabase.instance.InstallFromUrl(url);
                    }
                };

                parent.Add(addFromGitUrl);
                addFromGitUrl.Show();
            }, a => DropdownMenuAction.Status.Normal);

            addMenu.menu.AppendSeparator("");

            addMenu.menu.AppendAction("Create Package...", a =>
            {
                var defaultName              = PackageCreator.GenerateUniquePackageDisplayName("New Package");
                var createPackage            = new PackagesAction("Create", defaultName);
                createPackage.actionClicked += displayName =>
                {
                    createPackage.Hide();
                    var packagePath = PackageCreator.CreatePackage("Packages/" + displayName);
                    AssetDatabase.Refresh();
                    EditorApplication.delayCall += () =>
                    {
                        var path = Path.Combine(packagePath, "package.json");
                        var o    = AssetDatabase.LoadMainAssetAtPath(path);
                        if (o != null)
                        {
                            UnityEditor.Selection.activeObject = o;
                        }

                        PackageManagerWindow.SelectPackageAndFilter(displayName, PackageFilterTab.InDevelopment, true);
                    };
                };

                parent.Add(createPackage);
                createPackage.Show();
            }, a => DropdownMenuAction.Status.Normal);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.MenuExtensions)
                {
                    extension.OnAddMenuCreate(addMenu.menu);
                }
            });
        }