Code Folding Progress

I’m still making progress with code folding support in RSyntaxTextArea.  Several visual bugs were squashed (current line highlight, matched bracket painting when toggling folds), as well as a couple of “real” issues with the functionality.  The coolest thing that’s been added is folding support for XML:

XML Code Folding

XML Code Folding

Again, the actual rendering of the folded lines (color, the annotation at the end, etc.) is subject to change.  There are now also ways to do various folding stuff in the editor’s popup menu:

New Context Menu Items

New Context Menu Items

I’ll give these actions keyboard shortcuts moving forward, like those for Cut, Copy, etc.

Finally, note that, for any folded region, hovering the mouse over the “+” icon gives you a preview of the folded section, over-top where it would be in the editor:

Folded Content in Tool Tip

Folded Content in Tool Tip

Unfortunately, Ctrl+Print Screen in Windows doesn’t capture the mouse pointer, but you get the point!

Again, please try all this out by grabbing the latest from SVN!  Just call “textArea.setCodeFoldingEnabled(true)” and start tinkering with it.  Let me know any and all bugs you find!

4 Responses to “Code Folding Progress”

  1. Bob Fisch says:

    Hi

    Since the last version taken from the SVN I get often the following error:

    Exception in thread “AWT-EventQueue-0″ java.lang.NoClassDefFoundError: org/fife/rsta/ac/java/tree/LocalVarTreeNode
    at org.fife.rsta.ac.java.tree.JavaOutlineTree.createMemberNode(JavaOutlineTree.java:188)
    at org.fife.rsta.ac.java.tree.JavaOutlineTree.createTypeDeclarationNode(JavaOutlineTree.java:211)
    at org.fife.rsta.ac.java.tree.JavaOutlineTree.update(JavaOutlineTree.java:117)
    at org.fife.rsta.ac.java.tree.JavaOutlineTree.access$200(JavaOutlineTree.java:61)
    at org.fife.rsta.ac.java.tree.JavaOutlineTree$Listener.propertyChange(JavaOutlineTree.java:369)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:347)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
    at org.fife.rsta.ac.java.JavaParser.parse(JavaParser.java:157)
    at org.fife.ui.rsyntaxtextarea.ParserManager.actionPerformed(Unknown Source)
    at javax.swing.Timer.fireActionPerformed(Timer.java:291)
    at javax.swing.Timer$DoPostEvent.run(Timer.java:221)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:677)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:638)
    at java.awt.EventQueue$1.run(EventQueue.java:636)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:647)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.lang.ClassNotFoundException: org.fife.rsta.ac.java.tree.LocalVarTreeNode
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    … 26 more

    Greeetings

    Bob

  2. admin says:

    Hi Bob,

    Hmm, nothing’s changed with the Java source tree component lately. Can you give me more details on how to reproduce it? The RSTALanguageDemoSupport program seems okay with it when editing Java. Are you loading the library on the EDT or on another thread?

  3. Bob Fisch says:

    ReHi

    Actually I didn’t manage to find any special task or operation after which the exception shows up. It seams somewhat random. I know, these are the hardest bugs to catch :(

    I’ll try to get deeper into it, but until no without any new findind.

    The code editor runs in the same thread as the main application.

    greetings
    Bob

  4. [...] folding for C, Java, Perl, XML, MXML, and other languages (currently only available when word wrap is not [...]