Bug 228065 - source format appears in context menu for all files
Summary: source format appears in context menu for all files
Status: VERIFIED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-04-21 13:46 EDT by Amy Wu CLA
Modified: 2008-04-29 16:45 EDT (History)
1 user (show)

See Also:
for.work.things: review-
for.work.things: review+


Attachments
patch (14.49 KB, patch)
2008-04-23 15:52 EDT, Nick Sandonato CLA
no flags Details | Diff
removing multiple source menus (15.03 KB, patch)
2008-04-23 20:21 EDT, Nick Sandonato CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amy Wu CLA 2008-04-21 13:46:15 EDT
source->format menu should only appear in context menu for formattable files like
xml
html
jsp
css

not
dtd
all other sse files

probably need to contribute the format handler the same way other handlers are contributed for xml/html-specific actions.
Comment 1 Nick Sandonato CLA 2008-04-23 15:52:17 EDT
Created attachment 97300 [details]
patch

This patch addresses the issue of the Source context menu showing up in the project navigator for file types that don't have Formatting support. To accomplish this, the SSE UI plugin is no longer the sole provider of the Source menu.  The Source menu provided by SSE UI is available only for IContainers.

The XML, CSS, JSP, and HTML UI plugins all define their own Source menus that are only displayed for IFiles that have the required contentTypeId. To support files that may have content types that are based on other content types, the SSE Core plugin contributes a propertyTester that will ascend content types until they are exhausted, or a matching content type is found for the expected value. This means that XSD files will not need to provide their own Source menu, since their content type is based on the XML content type.

This also gives 4 new menu ids: xmlSourceMenuId, cssSourceMenuId, jspSourceMenuId,  and htmlSourceMenuId.
Comment 2 Nick Sandonato CLA 2008-04-23 15:56:29 EDT
Because 4 new source menus are being contributed, I'm marking this for PII.
Comment 3 Amy Wu CLA 2008-04-23 19:35:41 EDT
I flagged this as - because I don't think we should be creating 4 Source menus.  sse.ui should still be the one to create the one Source menu.  And then xml, html, jsp, css will need to dictate that the format command/handler should be visible/enabled.
Comment 4 Nick Sandonato CLA 2008-04-23 20:21:14 EDT
Created attachment 97334 [details]
removing multiple source menus

Each content-type is now responsible for activating and enabling the FormatHandler.  The Source menu is once again only contributed by the SSE UI plugin, but the visibility of it is requiring that the handler is enabled.
Comment 5 Nick Sandonato CLA 2008-04-23 20:22:16 EDT
Also removed PII from keywords as there are no new menu contributions with the most recent patch.
Comment 6 Amy Wu CLA 2008-04-23 22:52:14 EDT
Patch looks good.  I just made one small change in the menu definition in sse.ui to remove all the child tags within visibleWhen checkEnabled=true.

Released for this week's M7.
Comment 7 David Williams CLA 2008-04-24 00:45:27 EDT
mass change to add 'contributed' keyword based on bugzilla query, please correct if that's not accurate (by marking patches as obsolete and removing the 'contributed' keyword. 
Comment 8 Nick Sandonato CLA 2008-04-29 16:45:31 EDT
Verified in I20080429053810.