void FLevelCollectionModel::FillSourceControlSubMenu(FMenuBuilder& InMenuBuilder) { const FLevelCollectionCommands& Commands = FLevelCollectionCommands::Get(); if (CanExecuteSCC()) { if (CanExecuteSCCCheckOut()) { InMenuBuilder.AddMenuEntry( Commands.SCCCheckOut ); } if (CanExecuteSCCOpenForAdd()) { InMenuBuilder.AddMenuEntry( Commands.SCCOpenForAdd ); } if (CanExecuteSCCCheckIn()) { InMenuBuilder.AddMenuEntry( Commands.SCCCheckIn ); } InMenuBuilder.AddMenuEntry( Commands.SCCRefresh ); InMenuBuilder.AddMenuEntry( Commands.SCCHistory ); InMenuBuilder.AddMenuEntry( Commands.SCCDiffAgainstDepot ); } else { InMenuBuilder.AddMenuEntry( Commands.SCCConnect ); } }
bool FAssetContextMenu::AddSourceControlMenuOptions(FMenuBuilder& MenuBuilder) { MenuBuilder.BeginSection("AssetContextSourceControl", LOCTEXT("AssetSCCOptionsMenuHeading", "Source Control")); if ( ISourceControlModule::Get().IsEnabled() ) { if( CanExecuteSCCSync() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCSync", "Sync"), LOCTEXT("SCCSyncTooltip", "Updates the item to the latest version in source control."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCSync ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCSync ) ) ); } if ( CanExecuteSCCCheckOut() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCCheckOut", "Check Out"), LOCTEXT("SCCCheckOutTooltip", "Checks out the selected asset from source control."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCCheckOut ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCCheckOut ) ) ); } if ( CanExecuteSCCOpenForAdd() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCOpenForAdd", "Mark For Add"), LOCTEXT("SCCOpenForAddTooltip", "Adds the selected asset to source control."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCOpenForAdd ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCOpenForAdd ) ) ); } if ( CanExecuteSCCCheckIn() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCCheckIn", "Check In"), LOCTEXT("SCCCheckInTooltip", "Checks in the selected asset to source control."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCCheckIn ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCCheckIn ) ) ); } MenuBuilder.AddMenuEntry( LOCTEXT("SCCRefresh", "Refresh"), LOCTEXT("SCCRefreshTooltip", "Updates the source control status of the asset."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCRefresh ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCRefresh ) ) ); if( CanExecuteSCCHistory() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCHistory", "History"), LOCTEXT("SCCHistoryTooltip", "Displays the source control revision history of the selected asset."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCHistory ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCHistory ) ) ); MenuBuilder.AddMenuEntry( LOCTEXT("SCCDiffAgainstDepot", "Diff Against Depot"), LOCTEXT("SCCDiffAgainstDepotTooltip", "Look at differences between your version of the asset and that in source control."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCDiffAgainstDepot ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCDiffAgainstDepot ) ) ); } if( CanExecuteSCCRevert() ) { MenuBuilder.AddMenuEntry( LOCTEXT("SCCRevert", "Revert"), LOCTEXT("SCCRevertTooltip", "Reverts the asset to the state it was before it was checked out."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCRevert ), FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCRevert ) ) ); } } else { MenuBuilder.AddMenuEntry( LOCTEXT("SCCConnectToSourceControl", "Connect To Source Control"), LOCTEXT("SCCConnectToSourceControlTooltip", "Connect to source control to allow source control operations to be performed on content and levels."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteEnableSourceControl ), FCanExecuteAction() ) ); } MenuBuilder.EndSection(); return true; }