private void _brushList_BrushContextMenu(Brush brush)
        {
            // Do not attempt to display context menu for "(Erase)" item.
            if (brush == null)
            {
                return;
            }

            var brushRecord = BrushDatabase.Instance.FindRecord(brush);

            var brushContextMenu = new EditorMenu();

            brushContextMenu.AddCommand(TileLang.OpensWindow(TileLang.ParticularText("Action", "Show in Designer")))
            .Enabled(!brushRecord.IsMaster)     // Cannot edit a master brush :)
            .Action(() => {
                ToolUtility.ShowBrushInDesigner(brush);
            });

            var selectedTilesetBrush = brush as TilesetBrush;

            if (selectedTilesetBrush != null)
            {
                brushContextMenu.AddCommand(TileLang.ParticularText("Action", "Goto Tileset"))
                .Action(() => {
                    this.brushList.Model.View            = BrushListView.Tileset;
                    this.brushList.Model.SelectedTileset = selectedTilesetBrush.Tileset;

                    var designerWindow = RotorzWindow.GetInstance <DesignerWindow>();
                    if (designerWindow != null && !designerWindow.IsLocked)
                    {
                        designerWindow.SelectedObject = selectedTilesetBrush.Tileset;
                    }

                    this.Repaint();
                });
            }

            brushContextMenu.AddCommand(TileLang.ParticularText("Action", "Reveal Asset"))
            .Action(() => {
                EditorGUIUtility.PingObject(brush);
            });

            brushContextMenu.AddSeparator();

            brushContextMenu.AddCommand(TileLang.ParticularText("Action", "Refresh Preview"))
            .Action(() => {
                BrushUtility.RefreshPreviewIncludingDependencies(brush);
            });

            brushContextMenu.AddSeparator();

            brushContextMenu.AddCommand(TileLang.OpensWindow(TileLang.ParticularText("Action", "Create Duplicate")))
            .Action(() => {
                var window = CreateBrushWindow.ShowWindow <DuplicateBrushCreator>();
                window.SharedProperties["targetBrush"] = brush;
            });

            var brushDescriptor = BrushUtility.GetDescriptor(brush.GetType());

            brushContextMenu.AddCommand(TileLang.OpensWindow(TileLang.ParticularText("Action", "Create Alias")))
            .Enabled(brushDescriptor.SupportsAliases)
            .Action(() => {
                var window = CreateBrushWindow.ShowWindow <AliasBrushCreator>();
                window.SharedProperties["targetBrush"] = brush;
            });

            brushContextMenu.AddCommand(TileLang.OpensWindow(TileLang.ParticularText("Action", "Delete Brush")))
            .Action(() => {
                TileSystemCommands.DeleteBrush(brush, ToolUtility.SharedBrushListModel.View == BrushListView.Tileset);
            });

            brushContextMenu.ShowAsContext();
        }
        /// <summary>
        /// Specify brush that the edited brush is an alias of.
        /// </summary>
        /// <param name="brush">Target brush.</param>
        public void SetAliasTarget(Brush brush)
        {
            // Do not proceed if no changes have been made.
            if (brush == this.AliasBrush.target)
            {
                return;
            }

            Undo.RecordObject(this.Brush, TileLang.ParticularText("Action", "Set Target"));

            var brushDescriptor = (brush != null)
                ? BrushUtility.GetDescriptor(brush.GetType())
                : null;

            if (brush == this.AliasBrush || brush is AliasBrush)
            {
                // Brush cannot be an alias of itself or another alias.
                if (this.Window != null)
                {
                    this.Window.ShowNotification(new GUIContent(TileLang.Text("Cannot create alias of another alias brush.")));
                }
                this.AliasBrush.target = null;
            }
            else if (brush == null)
            {
                // No brush was specified, clear target.
                this.AliasBrush.target = null;
            }
            else if (brushDescriptor == null)
            {
                // Unknown target brush.
                if (this.Window != null)
                {
                    string targetBrushNicifiedName = ObjectNames.NicifyVariableName(brush.GetType().Name);
                    this.Window.ShowNotification(new GUIContent(string.Format(
                                                                    /* 0: nicified name of the target brush class (i.e. 'Uber Oriented Brush') */
                                                                    TileLang.Text("Cannot create alias of the unregistered brush '{0}'."),
                                                                    targetBrushNicifiedName
                                                                    )));
                }
                this.AliasBrush.target = null;
            }
            else if (!brushDescriptor.SupportsAliases)
            {
                // Brush does not support aliases.
                if (this.Window != null)
                {
                    this.Window.ShowNotification(new GUIContent(string.Format(
                                                                    /* 0: name of the target brush (i.e. 'Grass Platform') */
                                                                    TileLang.Text("Cannot create alias of '{0}'."),
                                                                    brushDescriptor.DisplayName
                                                                    )));
                }
                this.AliasBrush.target = null;
            }
            else
            {
                if (this.Window != null)
                {
                    this.Window.RemoveNotification();
                }

                // Update alias reference.
                this.AliasBrush.target = brush;
            }

            // Find out if target brush is a master brush.
            var targetBrushRecord = BrushDatabase.Instance.FindRecord(this.AliasBrush.target);

            if (targetBrushRecord != null)
            {
                this.isTargetMasterBrush = targetBrushRecord.IsMaster;
            }

            this.SetDirty();

            BrushUtility.RefreshPreview(this.Brush);
        }