Skip to main content



      Home
Home » Newcomers » Newcomers » How to fold Java if/while etc.?
How to fold Java if/while etc.? [message #143382] Thu, 16 March 2006 09:05 Go to next message
Eclipse UserFriend
Originally posted by: johann.petrak.gmail.com

I cannot seem to find a way to be able to fold code blocks withing
methods, like if/then/else, while etc.

For figuring out large chunks of code this is nearly indispensible.
Re: How to fold Java if/while etc.? [message #143416 is a reply to message #143382] Thu, 16 March 2006 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dalroth5.hotmail.com

Hello there.

By default Eclipse doesn't seem to do this; it will display folding buttons
for imports, methods and so on, but AFAICT not 'if-else' or 'try-catch' or
similar statements. From the help -> search facility it looks possible but
it also looks as if you have to roll your own, at least for now. The help
facility says:

"Java Folding Structure Provider
Identifier:
org.eclipse.jdt.ui.foldingStructureProviders
Since:
3.0
Description:
Contributions to this extension point define folding structures for the Java
editor. That is, they define the regions of a Java source file that can be
folded away. See org.eclipse.jface.text.source.ProjectionViewer for
reference.

Extensions may optionally contribute a preference block which will appear on
the Java editor preference page.

Configuration Markup:

<!ELEMENT extension (provider)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT provider EMPTY>
<!ATTLIST provider
id CDATA #REQUIRED
name CDATA #IMPLIED
class CDATA #REQUIRED
preferencesClass CDATA #IMPLIED>
* id - The unique identifier of this provider.
* name - The name of this provider. If none is given, the id is used
instead.
* class - An implementation of
org.eclipse.jdt.ui.text.folding.IJavaFoldingStructureProvide r
* preferencesClass - An implementation of
org.eclipse.jdt.ui.text.folding.IJavaFoldingPreferenceBlock


Examples:
See org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureP rovider for
an example.

Supplied Implementation:
org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureP rovider provides
the default folding structure for the Java editor.
org.eclipse.jdt.internal.ui.text.folding.DefaultJavaFoldingP referenceBlock
provides the preference block for the default structure provider."

Hope this might be useful.

Steve
Re: How to fold Java if/while etc.? [message #143426 is a reply to message #143382] Thu, 16 March 2006 10:02 Go to previous message
Eclipse UserFriend
Originally posted by: dalroth5.hotmail.com

Also see:

Re: Custom folding
From:
Tom Eicher <eclipse@tom.eicher.name>
Date:
Thursday 16 Mar 2006 06:39:26
Groups:
eclipse.newcomer
References: 1

a few posts down from here... :)

S
Previous Topic:Can't access "help contents" from a workbench - firewall problem?
Next Topic:viewing html file in a browser
Goto Forum:
  


Current Time: Fri Jul 18 03:25:32 EDT 2025

Powered by FUDForum. Page generated in 5.11800 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top