Community
Participate
Working Groups
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.
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).
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.
>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.
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. --