Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 84819 - [projection] need generalized folding structure provider
Summary: [projection] need generalized folding structure provider
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-09 14:14 EST by Amy Wu CLA
Modified: 2019-09-04 02:38 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amy Wu CLA 2005-02-09 14:14:33 EST
I looked in the 3.1 Plan and thought I saw this as a possible line item, 
however I did not see any bug associated with the item.  This bug is probably 
also related to bug 80157.

Most of the document folding support is already available in the base, 
including the ProjectionSupport and ProjectionAnnotationModel.  However, 
document folding is not really tied in with the AbstractDecoratedTextEditor, 
like it probably should be.  Specifically, there should be some sort of public 
interface like org.eclipse.jdt.ui.text.folding.IJavaFoldingStructureProvider.

I know currently Java editor and Ant editor have document folding, but I can 
seem many other text editors (XML, HTML, JSP) wanting to provide this feature, 
so there should be a common way to do this.
Comment 1 Dani Megert CLA 2005-02-10 03:42:54 EST
Amy, as I understand it there are two different requests:

- as stated in the summary: a generalized structure provider
  -> the providers are the ones that define the folding structure. What do you
     think would be the common thing of Java, Ant and XML provider i.e. what is
     of interest for you that you would like to see in Platform Text?

- as stated in comment 0 build the support into decorated text editor
  -> this a good request but has currently lower priority since clients are
     already enabled to provide folding. the focus of bug 80157 is to push
     down features which are currently only available in JDT UI and which can't
     be achieved yet using existing Platform Text code.

IJavaFoldingStructureProvider is introduced in JDT UI because it offers an
extension point where clients can contribute additional folding providers. Most
editor providers will probably not go that far and offer this extensibility
(take Ant as an example).
Comment 2 Amy Wu CLA 2005-02-10 10:54:47 EST
Actually, I only had one request, and that was the latter of the two you 
mentioned.  Perhaps I should have worded my summary better.
  While clients are able to provide their own folding, adding this ability to 
their editor is somewhat "messy"  In JavaEditor, the projectionsupport and 
projectionupdater need to be updated/added/removed.  The code to do so touches 
7 methods.  This means when any other editor wants to add code folding, they 
will also need to override those same 7 methods.  Code folding seems like a 
useful enough feature that it should be already hooked into a base editor, 
whether it be the AbstractDecoratedTextEditor, or a new editor that subclasses 
AbstractDecoratedTextEditor (like ProjectionViewer vs SourceViewer)
  I imagine the easiest way to do so is to add a method to the 
SourceViewerConfiguration like public IFoldingStructureProvider[] 
getFoldingStructureProvider(ISourceViewer).  Then the base editor can 
install/uninstall.
  As for what is actually in IFoldingStructureProvider.  Maybe just like 
IJavaFoldingStructureProvider, initialize, install, uninstall?  The main thing 
is the ability to pass in an IDocument and the ProjectionAnnotationModel 
(though if passing in the whole ITextEditor & ProjectionViewer is allowed, 
that would be nice)  That would basically be it.
  In regards to what you said about most editor providers not needing to go 
that far as to need an extension point for code folding, I disagree.  While 
the Ant editor may not need it, I can see other editors wanting to provide 
this flexibility.  For example, I can see the JSP editor providing basic code 
folding for just jsp scriptlet regions.  But then if custom tag providers 
would like special folding of their tags, they can add their own custom tag 
folding provider.  And how about code folding within script regions of html or 
jsp?  That would be neat.

FYI, I believe Bug 70617 is the request for a generalized structure provider.  
There is a proposal for code folding based on indentation.
Comment 3 Dani Megert CLA 2005-02-10 11:32:22 EST
>FYI, I believe Bug 70617 
I know about that one but for me that's a concrete folding provider based on
indentation rather than a generalized folding provider (I just wasn't 100% sure
what you meant with the summary).

As already stated in comment 1 I fully agree with the request.

>In regards to what you said about most editor providers not needing to go 
>that far as to need an extension point for code folding, I disagree.
I said "probably" ;-) Every editor provider can still choose to offer such an
extension point. But I agree that it would be helpful to have this in Platform
Text since the preference UI is always the same piece of code which clients
probably copy.
Comment 4 Lars Vogel CLA 2019-09-04 02:38:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it and remove the stalebug whiteboard tag. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--