Bug 579529 - 'Clear history' menu entry of ReopenEditorMenu alters visibility of 'Exit' or 'Restart' entries in the main 'File' menu
Summary: 'Clear history' menu entry of ReopenEditorMenu alters visibility of 'Exit' or...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.20   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-31 08:53 EDT by Katarina Behrens CLA
Modified: 2022-03-31 08:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.