title: JavaFX: TabPane context menu, depending on selected tab
body: <p>I want to have a TabPane with multiple tabs, with a context menu different for every tab. </p>
  
  <p>Setting the ContextMenu on the TabPane obviously results in the same ContextMenu used regardless of selected tab. I tried setting different ContextMenus on different Tabs, but this has two unwanted effects: </p>
  
  <ol>
  <li><p>The context menu is only opened when right-clicking on the tab header (whereas setting it on the TabPane allows right-clicking anywhere inside the tab). I want the user to be able to access the Context Menu from anywhere inside the tab, not just the header.</p></li>
  <li><p>Right-clicking on one tab header while another is selected still opens the context menu of the tab clicked on - I want the context menu to depend on the tab currently selected.</p></li>
  </ol>
  
  <p>The only way I could think of how to do it is to catch onContextMenuRequested, see which tab is currently selected, and set various MenuItems visible/invisible, but that seems pretty silly. Is there a better way of doing this?</p>
  
  <p>Edit: Calrification - the tab contents are Panes (VBox, GridPane, etc.) so setting the ContextMenu directly on the content is sadly impossible. </p>