MCPcopy Create free account
hub / github.com/SpartanJ/eepp / openFileStatusMenu

Method openFileStatusMenu

src/tools/ecode/plugins/git/gitplugin.cpp:1841–1878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1839}
1840
1841void GitPlugin::openFileStatusMenu( const Git::DiffFile& file ) {
1842 UIPopUpMenu* menu = UIPopUpMenu::New();
1843 menu->setId( "git_file_status_menu" );
1844
1845 menuAdd( menu, "git-open-file", i18n( "git_open_file", "Open File" ), "file" );
1846 menuAdd( menu, "git-diff", i18n( "git_open_diff", "Open Diff" ), "diff-single" );
1847
1848 if ( file.report.type != Git::GitStatusType::Staged ) {
1849 menuAdd( menu, "git-stage", i18n( "git_stage", "Stage" ), "diff-added" );
1850 } else {
1851 menuAdd( menu, "git-unstage", i18n( "git_unstage", "Unstage" ), "diff-removed" );
1852 }
1853
1854 menu->addSeparator();
1855
1856 if ( file.report.type != Git::GitStatusType::Staged )
1857 menuAdd( menu, "git-discard", i18n( "git_discard", "Discard" ) );
1858
1859 menu->on( Event::OnItemClicked, [this, file]( const Event* event ) {
1860 if ( !mGit )
1861 return;
1862 UIMenuItem* item = event->getNode()->asType<UIMenuItem>();
1863 std::string id( item->getId() );
1864 if ( id == "git-stage" ) {
1865 stage( { file.file } );
1866 } else if ( id == "git-unstage" ) {
1867 unstage( { file.file } );
1868 } else if ( id == "git-discard" ) {
1869 discard( file.file );
1870 } else if ( id == "git-open-file" ) {
1871 openFile( file.file );
1872 } else if ( id == "git-diff" ) {
1873 diff( file.file, file.report.type );
1874 }
1875 } );
1876
1877 menu->showOverMouseCursor();
1878}
1879
1880void GitPlugin::runAsync( std::function<Git::Result()> fn, bool _updateStatus, bool _updateBranches,
1881 bool displaySuccessMsg, bool updateBranchesOnError,

Callers

nothing calls this directly

Calls 7

addSeparatorMethod · 0.80
getNodeMethod · 0.80
showOverMouseCursorMethod · 0.80
getIdMethod · 0.65
NewFunction · 0.50
setIdMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected