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

Bug 376542

Summary: Only one edit command contribution appears at a time
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: EditorAssignee: Susan McCourt <susan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.5   
Target Milestone: 0.5 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2012-04-11 17:45:22 EDT
1. Go to "Get Plugins" catalog
2. Install the Beautify and Uglify plugins.
   These plugins both contribute a single command to orion.edit.command, and both commands target application/javascript files.
3. Open a javascript file.
4. I expected to see both "uglify js" and "format js" in the toolbar, but I see only "format js".

If I uninstall the beautify plugin, I see the "uglify js" button.
Comment 1 Susan McCourt CLA 2012-04-11 17:50:32 EDT
I will look into this.  This rings a bell, it may not be a new problem.
Comment 2 Susan McCourt CLA 2012-04-12 13:05:47 EDT
The problem was that the initial rendering of the toolbar happens before metadata is retrieved.  The code that validates a command can optionally transform the target "item" for the tools to something different.  For editor commands, the editor gets the cached metadata from its input manager when validating commands.  However the metadata is not there yet, and the validation function was not bulletproofed for getting a null item back from the transform function.  This caused the command rendering to blow out in the middle of rendering.

The bandaid for M1 is to guard the validation function to check for null items.  Longer term I think we need to revisit the sequence for rendering command extensions.  We should probably make sure we have metadata before we bother to process command contributions. I also noticed while debugging that we are rendering too many times, and the reason for doing so is no longer valid.  Opened bug 376640 for this.