Bug 109045 - [outline] Hide comments in XML outline
Summary: [outline] Hide comments in XML outline
Status: VERIFIED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 0.7   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Sarika Sinha CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: bugday, helpwanted
Depends on:
Blocks:
 
Reported: 2005-09-08 09:18 EDT by Joakim Kemeny CLA
Modified: 2011-03-04 11:18 EST (History)
6 users (show)

See Also:
nsand.dev: review+


Attachments
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types (39.32 KB, patch)
2010-02-09 06:26 EST, Sarika Sinha CLA
no flags Details | Diff
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types (91.77 KB, patch)
2010-02-10 04:04 EST, Sarika Sinha CLA
no flags Details | Diff
Refined Patch (91.91 KB, patch)
2010-02-22 04:43 EST, Sarika Sinha CLA
no flags Details | Diff
Moved the filters to be used in plugin.xml out of internal package (97.47 KB, patch)
2010-06-21 06:11 EDT, Sarika Sinha CLA
no flags Details | Diff
Patch to add the new Filter using Command Handler Framework (102.01 KB, patch)
2010-11-10 12:37 EST, Sarika Sinha CLA
no flags Details | Diff
Filter icon (219 bytes, image/gif)
2010-11-16 12:48 EST, Sarika Sinha CLA
no flags Details
Custom Handler Patch with property tester (99.36 KB, patch)
2010-11-16 12:54 EST, Sarika Sinha CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Kemeny CLA 2005-09-08 09:18:25 EDT
It would be very nice if an action could be added to the xml ouline view to to 
hide the comments. This will increase the usability of the outline.
Comment 1 Steve Speicher CLA 2005-09-23 10:39:12 EDT
To take it a step further, a generic filter mechanism would be nice as well. 
Though I agree the most important is hiding comments...as the outline/tree views
are fairly unreadable/usable with documents with a ton of comments.

See Task, Package Explorer, Problem views for similar filter feature.
Comment 2 Nitin Dahyabhai CLA 2007-09-13 05:00:07 EDT
That kind of filtering would be handy, but it would need to be generic and yet still adapt to the kind of file being edited.  It's a great idea, but we don't have people to work on this just now.  We would accept high quality patches, though.
Comment 3 Amy Wu CLA 2008-02-04 12:57:58 EST
mass reassignment of my bugs to xml-inbox
Comment 4 David Carver CLA 2008-03-02 10:13:20 EST
nitin, this sounds like a bug day candidate...and I would have to agree, being able to hide the comments would make the outline view much more useful when dealing with heavily commented xml files.
Comment 5 Laknath CLA 2008-05-04 09:52:22 EDT
I would like to work on this. I'm a GSoC student for Eclipse this year and this is a good place to start. 
Comment 6 Sarika Sinha CLA 2010-02-09 06:26:04 EST
Created attachment 158575 [details]
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types

patch to add a User Defined Pattern Filter at UI Level. JavaElementFilter extension pt of JDT is further used to add named Filters for different content types like html, jsp and XML. Currently I have added CDATA, Comments  and Processing Instruction Named Filter for XML and html/JSP has Import Directive and Font Style Filter. More Filters can be added at any point for any content type.
Comment 7 David Carver CLA 2010-02-09 12:35:33 EST
(In reply to comment #6)
> Created an attachment (id=158575) [details]
> Patch to add the User Defined pattern Filter for sse and different Named
> Filters for content types
> 
> patch to add a User Defined Pattern Filter at UI Level. JavaElementFilter
> extension pt of JDT is further used to add named Filters for different content
> types like html, jsp and XML. Currently I have added CDATA, Comments  and
> Processing Instruction Named Filter for XML and html/JSP has Import Directive
> and Font Style Filter. More Filters can be added at any point for any content
> type.

My concern with this is are we tying this in anyway to having a dependency on JDT that will require JDT be installed?  Particularly the requirement with JavaElementFilter.   For the JSP editor this might be fine, but I'd hope that SSE/HTML/XML, etc can be kept clean.
Comment 8 Nick Sandonato CLA 2010-02-09 16:35:46 EST
(In reply to comment #7)
> (In reply to comment #6)
> > Created an attachment (id=158575) [details] [details]
> > Patch to add the User Defined pattern Filter for sse and different Named
> > Filters for content types
> > 
> > patch to add a User Defined Pattern Filter at UI Level. JavaElementFilter
> > extension pt of JDT is further used to add named Filters for different content
> > types like html, jsp and XML. Currently I have added CDATA, Comments  and
> > Processing Instruction Named Filter for XML and html/JSP has Import Directive
> > and Font Style Filter. More Filters can be added at any point for any content
> > type.
> 
> My concern with this is are we tying this in anyway to having a dependency on
> JDT that will require JDT be installed?  Particularly the requirement with
> JavaElementFilter.   For the JSP editor this might be fine, but I'd hope that
> SSE/HTML/XML, etc can be kept clean.

Hi, Sarika. I agree with Dave. I'd prefer if we didn't add a dependency on the JDT to support outline filtering. Is it possible to revise the patch to remove this?
Comment 9 Sarika Sinha CLA 2010-02-10 04:04:32 EST
Created attachment 158676 [details]
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types

Removed the jdt dependency from sse,xml and html plugins. Added some new classes in SSE to achieve this.
Comment 10 Nitin Dahyabhai CLA 2010-02-19 01:23:07 EST
Small comments for the next iteration of the patch: we usually don't need to label a class SSE* as it's already in our package namespace, and even then we've tended to use "Structured" as the prefix if it's in sse.core or sse.ui.

Also, are those extra keys in the sse.ui plugin.properties file?

+#Filter Support
+
+HideImportDeclaration.label= Import declarations
+HideImportDeclaration.description= Hides all import declarations
Comment 11 Sarika Sinha CLA 2010-02-22 04:43:12 EST
Created attachment 159755 [details]
Refined Patch

Refactored few class names and removed the extra plugin property from sse.ui as suggested in review comment.
Comment 12 Nick Sandonato CLA 2010-04-07 11:55:26 EDT
We'll try to take a look at this for 3.3.
Comment 13 Nick Sandonato CLA 2010-06-14 12:03:43 EDT
Hi Sarika, one of the things I think that will need to be fixed is how many things are in API packages. Can you filter down what we're actually going to offer as API classes (if any) otherwise, these need to be in internal packages.
Comment 14 Sarika Sinha CLA 2010-06-21 06:11:58 EDT
Created attachment 172315 [details]
Moved the filters to be used in plugin.xml out of internal package

Synched up the code with latest code and moved the filters out of internal package.
Comment 15 Nick Sandonato CLA 2010-09-28 16:42:39 EDT
Hey, Sarika. I think we're almost there.

* I think what is exactly API still needs to be identified. I don't think any of these new classes really need to be exposed as API. Right now, there are a lot of things exposed as API. In particular, it seems like the entire org.eclipse.wst.sse.ui.filters package could be internal. Also, I don't think the CustomFilterAction or CustomFilterActionContributionItem need to be in an API package.
* For the extension point, is the "pattern" attribute necessary? The documentation for it says it shouldn't be used (and we haven't even released it yet)
* We may want to add a Comment filter for HTML and JSPs. CSS may benefit from a comment filter as well.
* Something nitpicky, but I would probably have a protected method like getOutlineFilterTarget() and override it instead of having the setter, then you can just invoke the method instead.
* It looks like some classes were based on work from the JDT. It might be worth commenting that in the Javadoc and also cleanup comments like "since 2.0" because it's brand new for Source Editing.
* I also think we need an icon. I think there's a standard one used by the Problems view and JDT's outline.

Thanks for your continued work on this!
Comment 16 David Carver CLA 2010-09-28 17:04:43 EDT
Is there a particular reason we are using Actions instead of Commands and Handlers as well as the menu ui extension point?
Comment 17 Nitin Dahyabhai CLA 2010-09-29 14:22:07 EDT
What's being made available is a mechanism for contributing the filters themselves.  The UI for controlling them is fixed as coming from the ContentOutlineConfiguration, which doesn't really demand the abstractions of commands and handlers.  Apart from the keybindings this would allow, is there a reason to favor it?
Comment 18 David Carver CLA 2010-09-29 14:58:45 EDT
(In reply to comment #17)
> What's being made available is a mechanism for contributing the filters
> themselves.  The UI for controlling them is fixed as coming from the
> ContentOutlineConfiguration, which doesn't really demand the abstractions of
> commands and handlers.  Apart from the keybindings this would allow, is there a
> reason to favor it?

The action framework is not the recommended way forward.  It doesn't allow adopters much flexibility in providing their own implementations and handlers.   The commands, handlers, and menui is more more adopter friendly approach.   It also separates the implementation much better as well.

It's the reason we did the big migration a couple of years ago for the other portions to allow adopters more flexibility.
Comment 19 Sarika Sinha CLA 2010-11-10 12:37:34 EST
Created attachment 182837 [details]
Patch to add the new Filter using Command Handler Framework

Hi Nick,
The attached patch takes care of the following review comments :
1) converted new action to command handler framework
2) moved the filiet classes to internal
3) removed JDT legacy comments
4) changed setter to overriding getters
5) removed unused pattern from schema
6) added the filter icon
Comment 20 Nick Sandonato CLA 2010-11-15 18:00:31 EST
Hi Sarika,

Thanks for the updates. I've got a few things.

1. Can this be refactored so that we don't expose the treeViewer from the ConfigurableContentOutlinePage and the preference store from the ContentOutlineConfiguration? The one I'm more concerned about is exposing the treeViewer.

2. We need to make sure that the filters menu is only added to the menu when our ConfigurableContentOutlinePage is used (right now, our Filters shows up for the Java or Manifest outlines).

3. The extension point name may be better as "Outline Filters".

4. There are still references to 'org.eclipse.jdt.ui.javaElementFilters" extension point.' These kinds of things need to be cleaned up. And there are assert messages that log the extension-point "org.eclipse.jdt.ui.javaElementFilters"

5. OutlineFilterMessages.properties's filterCreationError_message looks like it got mangled a bit.

6. I don't think we need the Font Style's filter for HTML. These can all be removed through a custom filter and also a lot of these are fairly important semantically to the document and you'd lose a lot of elements if you just wanted to remove one of them. It also looks like a string got mangled for it ("HideFontStyle.description=Hides Font Style TagsproposalCategory.htmlTags=HTML Tag Proposals").

7. Finally, the icon needs to be attached separately from the patch. If it's included with the patch, it will actually prevent me from applying it.
Comment 21 Sarika Sinha CLA 2010-11-16 12:48:42 EST
Created attachment 183247 [details]
Filter icon
Comment 22 Sarika Sinha CLA 2010-11-16 12:54:47 EST
Created attachment 183248 [details]
Custom Handler Patch with property tester
Comment 23 Sarika Sinha CLA 2010-11-16 13:06:56 EST
Hi Nick,
I have added a property tester for outline page instance verification and refactored the Handler method inside configuration class .Font filter has been removed and the jdt.ui references have been cleaned up.
I have added the Filter icon seperately and renamed the extn to "Outline Filters".
Comment 24 Nick Sandonato CLA 2011-03-02 15:54:14 EST
Thanks, Sarika. I've checked in your changes with some minor alternations and consolidations (e.g., removed Node references in sse.ui).
Comment 25 Nick Sandonato CLA 2011-03-04 11:18:32 EST
Verified against I-3.3.0-20110303220333.