예제 #1
0
        static bool ProcessKeyActionForPendingChangesMenu(
            PendingChangesMenuOperations operationToExecute,
            IPendingChangesMenuOperations pendingChangesMenuOperations,
            SelectedChangesGroupInfo info)
        {
            PendingChangesMenuOperations operations =
                PendingChangesMenuUpdater.GetAvailableMenuOperations(info);

            if (!operations.HasFlag(operationToExecute))
            {
                return(false);
            }

            ProcessPendingChangesMenuOperation(
                operationToExecute, pendingChangesMenuOperations);

            return(true);
        }
예제 #2
0
        static bool ProcessKeyActionForPendingChangesMenu(
            WorkspaceInfo wkInfo,
            PendingChangesMenuOperations operationToExecute,
            IPendingChangesMenuOperations pendingChangesMenuOperations,
            SelectedChangesGroupInfo info,
            bool isGluonMode)
        {
            PendingChangesMenuOperations operations =
                PendingChangesMenuUpdater.GetAvailableMenuOperations(info);

            if (!operations.HasFlag(operationToExecute))
            {
                return(false);
            }

            ProcessPendingChangesMenuOperation(
                wkInfo, operationToExecute, pendingChangesMenuOperations, isGluonMode);

            return(true);
        }
예제 #3
0
        internal bool ProcessKeyActionIfNeeded(Event e)
        {
            PendingChangesMenuOperations operationToExecute = GetMenuOperation(e);

            if (operationToExecute == PendingChangesMenuOperations.None)
            {
                return(false);
            }

            SelectedChangesGroupInfo info =
                mPendingChangesMenuOperations.GetSelectedChangesGroupInfo();
            PendingChangesMenuOperations operations =
                PendingChangesMenuUpdater.GetAvailableMenuOperations(info);

            if (!operations.HasFlag(operationToExecute))
            {
                return(false);
            }

            ProcessMenuOperation(operationToExecute, mPendingChangesMenuOperations);
            return(true);
        }
예제 #4
0
        void UpdateMenuItems(GenericMenu menu)
        {
            SelectedChangesGroupInfo info =
                mPendingChangesMenuOperations.GetSelectedChangesGroupInfo();

            PendingChangesMenuOperations operations =
                PendingChangesMenuUpdater.GetAvailableMenuOperations(info);

            OpenMenuOperations openOperations =
                GetOpenMenuOperations.ForPendingChanges(info);

            if (operations == PendingChangesMenuOperations.None &&
                openOperations == OpenMenuOperations.None)
            {
                menu.AddDisabledItem(GetNoActionMenuItemContent());
                return;
            }

            UpdateOpenMenuItems(menu, openOperations);

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(PendingChangesMenuOperations.DiffWorkspaceContent))
            {
                menu.AddItem(mDiffMenuItemContent, false, DiffMenuItem_Click);
            }
            else
            {
                menu.AddDisabledItem(mDiffMenuItemContent);
            }

            if (mMetaMenuOperations.SelectionHasMeta())
            {
                if (operations.HasFlag(PendingChangesMenuOperations.DiffWorkspaceContent))
                {
                    menu.AddItem(mDiffMetaMenuItemContent, false, DiffMetaMenuItem_Click);
                }
                else
                {
                    menu.AddDisabledItem(mDiffMetaMenuItemContent);
                }
            }

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(PendingChangesMenuOperations.UndoChanges))
            {
                menu.AddItem(mUndoChangesMenuItemContent, false, UndoChangesMenuItem_Click);
            }
            else
            {
                menu.AddDisabledItem(mUndoChangesMenuItemContent);
            }

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(PendingChangesMenuOperations.ApplyLocalChanges))
            {
                menu.AddItem(mCheckoutMenuItemContent, false, CheckoutMenuItem_Click);
            }
            else
            {
                menu.AddDisabledItem(mCheckoutMenuItemContent);
            }

            if (operations.HasFlag(PendingChangesMenuOperations.Delete))
            {
                menu.AddItem(mDeleteMenuItemContent, false, DeleteMenuItem_Click);
            }
            else
            {
                menu.AddDisabledItem(mDeleteMenuItemContent);
            }

            menu.AddSeparator(string.Empty);

            mFilterMenuBuilder.UpdateMenuItems(
                menu, FilterMenuUpdater.GetMenuActions(info));

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(PendingChangesMenuOperations.History))
            {
                menu.AddItem(mViewHistoryMenuItemContent, false, HistoryMenuItem_Click);
            }
            else
            {
                menu.AddDisabledItem(mViewHistoryMenuItemContent, false);
            }

            if (mMetaMenuOperations.SelectionHasMeta())
            {
                if (operations.HasFlag(PendingChangesMenuOperations.History))
                {
                    menu.AddItem(mViewHistoryMetaMenuItemContent, false, HistoryMetaMenuItem_Click);
                }
                else
                {
                    menu.AddDisabledItem(mViewHistoryMetaMenuItemContent);
                }
            }
        }