With this solution the tab(s) will be visible when the specific webpart will be on the page.
Create a SharePoint visual studio 2010 visual webpart project with the following ingredients:
In the XML-files you can find the tab and the groups with it's buttons and it's behaviour. In this file you can only find a shortcut to the event handler that will be fired when the button in the ribbon is clicked. In the feature the xml sections will be added to the cmdgui.xml file in the 14-hyve. The ribbon tab is a normal ribbon tab and not a contextualtab (like doc library (documents, library)).
The WebPart contains code in the prerender method to:
- read the xml-files for the tabgroups and tabs
- put the xml in the OOB SharePoint cmdgui.xml file
- put in some code for the event handler