Bug 579529

Summary: 'Clear history' menu entry of ReopenEditorMenu alters visibility of 'Exit' or 'Restart' entries in the main 'File' menu
Product: [Eclipse Project] Platform Reporter: Katarina Behrens <katarina.behrens>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.20   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Katarina Behrens CLA 2022-03-31 08:53:45 EDT
In our Eclipse RCP application we reimplement org.eclipse.ui.application.ActionBarAdvisor in order to insert some entries into 'File' menu of the main window, among others also a list of recently used files.

We use org.eclipse.ui.internal.ReopenEditorMenu to do that in such a way that the entries w/ recently opened files are inlined withing top-level 'File' menu (i.e. they are not in a separate 'Recent Files' sub-menu). Here is some code implementing that:

MenuManager fileMenu = new MenuManager( Messages.ApplicationActionBarAdvisor_fileMenuLabel,
                IWorkbenchActionConstants.M_FILE );
fileMenu.add( new GroupMarker( IWorkbenchActionConstants.FILE_START ) );
...
fileMenu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
fileMenu.add( new Separator() );
// This one has no use in the Squish IDE
// fileMenu.add( getPropertiesItem() );
...
fileMenu.add( new ReopenEditorMenu( window, "reopenEditors", false ) );
fileMenu.add( new GroupMarker( IWorkbenchActionConstants.MRU ) );

Since 'Clear history' entry was added to ReopenEditoMenu class, 'File' menu started to misbehave. 
1st time the user clicks on 'File', 'Exit' entry is missing, 2nd time 'Exit' is there but 'Restart' entry is missing. If there are no recently opened files entries, both 'Exit' and 'Restart' are missing or both are there. 

Here is another Eclipse RCP application describing more-less the same problem: https://bugs.openjdk.java.net/browse/JMC-6313
I can confirm that the work-around suggested by them -- recently opened files as a separate sub-menu -- works for us as well.