示例#1
0
        internal bool ProcessKeyActionIfNeeded(Event e)
        {
            HistoryMenuOperations operationToExecute = GetMenuOperation(e);

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

            SelectedHistoryGroupInfo info =
                mOperations.GetSelectedHistoryGroupInfo();

            HistoryMenuOperations operations =
                HistoryMenuUpdater.GetAvailableMenuOperations(info);

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

            ProcessMenuOperation(operationToExecute, mOperations);
            return(true);
        }
示例#2
0
        void UpdateMenuItems(GenericMenu menu)
        {
            SelectedHistoryGroupInfo info =
                mOperations.GetSelectedHistoryGroupInfo();

            HistoryMenuOperations operations =
                HistoryMenuUpdater.GetAvailableMenuOperations(info);

            if (operations == HistoryMenuOperations.None)
            {
                menu.AddDisabledItem(GetNoActionMenuItemContent(), false);
                return;
            }

            if (operations.HasFlag(HistoryMenuOperations.Open))
            {
                menu.AddItem(mOpenRevisionMenuItemContent, false, OpenRevisionMenu_Click);
            }
            else
            {
                menu.AddDisabledItem(mOpenRevisionMenuItemContent, false);
            }

            if (operations.HasFlag(HistoryMenuOperations.OpenWith))
            {
                menu.AddItem(mOpenRevisionWithMenuItemContent, false, OpenRevisionWithMenu_Click);
            }
            else
            {
                menu.AddDisabledItem(mOpenRevisionWithMenuItemContent, false);
            }

            if (operations.HasFlag(HistoryMenuOperations.SaveAs))
            {
                menu.AddItem(mSaveRevisionAsMenuItemContent, false, SaveRevisionasMenu_Click);
            }
            else
            {
                menu.AddDisabledItem(mSaveRevisionAsMenuItemContent, false);
            }

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(HistoryMenuOperations.DiffWithPrevious))
            {
                menu.AddItem(mDiffWithPreviousMenuItemContent, false, DiffWithPreviousMenuItem_Click);
            }

            if (operations.HasFlag(HistoryMenuOperations.DiffSelected))
            {
                menu.AddItem(mDiffSelectedRevisionsMenuItemContent, false, DiffSelectedRevisionsMenu_Click);
            }

            mDiffChangesetMenuItemContent.text =
                PlasticLocalization.GetString(PlasticLocalization.Name.HistoryMenuItemDiffChangeset) +
                string.Format(" {0}", GetSelectedChangesetName(mMenuOperations));

            if (operations.HasFlag(HistoryMenuOperations.DiffChangeset))
            {
                menu.AddItem(mDiffChangesetMenuItemContent, false, DiffChangesetMenu_Click);
            }
            else
            {
                menu.AddDisabledItem(mDiffChangesetMenuItemContent, false);
            }

            menu.AddSeparator(string.Empty);

            if (operations.HasFlag(HistoryMenuOperations.RevertTo))
            {
                menu.AddItem(mRevertToThisRevisionMenuItemContent, false, RevertToThisRevisionMenu_Click);
            }
            else
            {
                menu.AddDisabledItem(mRevertToThisRevisionMenuItemContent, false);
            }
        }