static bool ProcessKeyActionForOpenMenu( OpenMenuOperations openOperationToExecute, IOpenMenuOperations openMenuOperations, SelectedChangesGroupInfo info) { OpenMenuOperations openOperations = GetOpenMenuOperations.ForPendingChanges(info); if (!openOperations.HasFlag(openOperationToExecute)) { return(false); } ProcessOpenMenuOperation( openOperationToExecute, openMenuOperations); return(true); }
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); } } }