Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340437

Summary: Photran's dynamic "Refactor" menu does not display correctly in e4
Product: [Eclipse Project] e4 Reporter: Jeffrey Overbey <com-eclipse-dot-org>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 332668    
Bug Blocks: 344260    
Attachments:
Description Flags
Expected contents of Refactor menu
none
Actual contents of Refactor menu
none
Screenshot depicting the behaviour in question. none

Description Jeffrey Overbey CLA 2011-03-18 11:03:24 EDT
Photran contributes a dynamic menu which does not display correctly in e4.

The relevant XML is below.  We hijack the ID of JDT's "Refactor" menu to make sure there's never more than one Refactor menu visible.  Then, we populate the menu items in the Refactor menu dynamically, based on the active selection (via a subclass of CompoundContributionItem).  In e4 (4.1 M6), there generally seemed to be only one item in the menu, although there should be more than that.

  <extension point="org.eclipse.ui.menus">
     <menuContribution
           locationURI="menu:org.eclipse.ui.main.menu?before=navigate">
        <menu
              label="%menu.label"
              id="org.eclipse.jdt.ui.refactoring.menu">
           <dynamic
                 class="org.eclipse.rephraserengine.ui.menus.RefactorMenu"
                 id="org.eclipse.rephraserengine.ui.menus.refactor">
           </dynamic>

Steps to reproduce:

0. I tested this against 4.1 M6.  Install Eclipse 3.7 M5 for comparison.
http://download.eclipse.org/eclipse/downloads/drops/S-3.7M5-201101272034/index.php

1. Install CDT 8 M5 (required by Photran 7)
http://download.eclipse.org/tools/cdt/builds/8.0.0/I.I201101311025/index.html

2. Install Photran 7 M5 (Photran is a component of PTP, so it's in this update site)
http://download.eclipse.org/tools/ptp/builds/indigo/I.I201101311805/index.html

You should get "Welcome to Photran 7" in a Web browser after installation.  Also, there are two Source menus in the Java perspective; ignore that (it's fixed in more recent builds).

3. Create a new Fortran project; choose the appropriate "Executable (Gnu Fortran)" project type when asked

4. Switch to the Fortran perspective when asked

5. Add a file named "test.f90" to the project; it can be empty

6. In the project properties, navigate to Fortran General > Analysis/Refactoring, and check the "Enable Fortran analysis/refactoring" checkbox

7. Now, with test.f90 in the active editor, click on the Refactor menu.  The expected and actual results are shown in the attached screenshots.
Comment 1 Jeffrey Overbey CLA 2011-03-18 11:07:34 EDT
Created attachment 191517 [details]
Expected contents of Refactor menu
Comment 2 Jeffrey Overbey CLA 2011-03-18 11:07:51 EDT
Created attachment 191518 [details]
Actual contents of Refactor menu
Comment 3 Remy Suen CLA 2011-06-09 07:51:07 EDT
Created attachment 197686 [details]
Screenshot depicting the behaviour in question.

Hi Jeff, this is what I see right now with our I20110604-2201 build. Is this the proper structure? It doesn't seem to match attachment 191518 [details] but it seems a lot of the entries in that screenshot are now in submenus.
Comment 4 Jeffrey Overbey CLA 2011-06-10 00:02:11 EDT
Hi Remy,

Yes, we reorganized the menu recently (after growing to 31 refactorings), so that is the correct structure with the most recent builds of Photran.  The screenshot looks good; thanks!

Jeff
Comment 5 Remy Suen CLA 2011-06-10 16:56:10 EDT
(In reply to comment #4)
> Yes, we reorganized the menu recently (after growing to 31 refactorings), so
> that is the correct structure with the most recent builds of Photran.  The
> screenshot looks good; thanks!

Thank you very much for verifying, Jeffrey. And thank you for testing Eclipse 4.1!