Code Folding

I can't get Homesite to maintain folded code when I close a
file. I'm certain that I was able to do that on a previous
installation. Is anyone else able to maintain folded code when you
close and open a file?
Thanks,
Rick

I think you're going to need to be more specific with your question. What exactly is it you want to accomplish? Code folding, as I understand it, is something thats editor dependent.
For example, in NetBeans you can add the comment line "//<editor-fold>" to the beginning of the text (it can be anywhere) you want to fold and "//</editor-fold>" to the end, and NetBeans will allow you to fold and open the text (and the editor-fold comments) between them. It doesn't work with block (/* and */) comments, though.

Similar Messages

  • Bug with code folding margin

    Hi all.
    I'm using SQL Developer 3.1.07.42 for win32, windows 7.
    Not sure but probably bug - Tools|Preferences|Code Editor|Display|Show Code Folding Margin works only for current worksheet.
    If I open any another worksheet (no matter unshared it or not) this margin comes up even if checkbox Show Code Folding Margin is unchecked.
    Is it bug or feature?

    I can reproduce it, but I'm not sure where the bug lies.
    The worksheet and the code editor aren't the same (perhaps they should be) and the bug may be that the preference affects the current worksheet at all. The preference seems to work correctly for code editors.

  • How is the 'code fold' functionality implemented?

    Hi all,
    I'm thinking that I'd like to have a form, which is broken into several categories, that has 'code fold' functionality ala NetBeans. I'm thinking the way to do this would be to simply place all of these JPanels in the form in the nodes of a tree, when collapsed, just the title is displayed, when they expand, the JPanel appears. I admit I've not yet tried this approach yet , I first wanted to find out if anyone has done something like this and what approach they might use. Any feedback is appreciated.
    Thanks
    Mike

    I read this and thought it would be great to have in my own app.
    So, after getting some code from these forums I have cobbled together the following classes.
    This one creates a collapsible panel:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.LayoutManager;
    import java.awt.Rectangle;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;
    import javax.swing.border.LineBorder;
    * CollapsiblePanel.java Created on 22-Apr-2005
    public class CollapsiblePanel extends JPanel
        private class TitlePanel extends JPanel
            private Color fadeto = new Color(200, 212, 247);
            public TitlePanel(LayoutManager layout)
                super(layout);
            protected void paintComponent(Graphics g)
                GradientPaint gradient = new GradientPaint(0, 0, Color.white,
                        getSize().width - 10, getSize().height, fadeto, true);
                Graphics2D g2d = (Graphics2D) g;
                g2d.setPaint(gradient);
                g2d.fill(new Rectangle(getSize().width, getSize().height));
        private JPanel mPanel = new JPanel(new GridLayout(0, 1, 2, 2));
        private JLabel mTitle;
        private JLabel mButton;
        public CollapsiblePanel(String title)
            setLayout(new BorderLayout());
            final Color active = new Color(66, 142, 255);
            final Color inactive = new Color(33, 93, 198);
            final ImageIcon up = new ImageIcon("Up.gif");
            final ImageIcon down = new ImageIcon("Down.gif");
            mTitle = new JLabel(title);
            mTitle.setForeground(inactive);
            mButton = new JLabel(up);
            TitlePanel panel = new TitlePanel(new BorderLayout());
            panel.setBorder(new LineBorder(Color.BLACK));//EmptyBorder(2, 2, 2, 2));
            panel.add(mTitle, BorderLayout.CENTER);
            panel.add(mButton, BorderLayout.EAST);
            panel.addMouseListener(new MouseAdapter()
                public void mouseClicked(MouseEvent e)
                    mPanel.setVisible(!mPanel.isVisible());
                    mButton.setIcon(mPanel.isVisible() ? up : down);
                public void mouseEntered(MouseEvent e)
                    mTitle.setForeground(active);
                public void mouseExited(MouseEvent e)
                    mTitle.setForeground(inactive);
            panel.setBackground(Color.WHITE);
            mPanel.setBorder(new EmptyBorder(2, 2, 2, 2));
            //mPanel.setBackground(new Color(214, 223, 247));
            add(panel, BorderLayout.NORTH);
            add(mPanel, BorderLayout.CENTER);
        public Component add(Component comp)
            return mPanel.add(comp);
    }This one creates a panel to hold many collapsible panels.
    NOTE: This uses the TableLayout manager which can be found on the web. I am sure that all of you here could change it to use GridbagLayout.
    import javax.swing.JPanel;
    import info.clearthought.layout.TableLayout;
    * Panel to hold many CollapsiblePanels
    * @author Garry Lovesey
    * @version 1.0 22-Apr-2005
    public class CollapsiblePanelBar2 extends JPanel
        public static double PREFERRED = TableLayout.PREFERRED;
        public static double FILL = TableLayout.FILL;
        private TableLayout layout;
        public CollapsiblePanelBar2(CollapsiblePanel panel, double layoutPreference)
            super();
             // create the GUI
              // b - border
              // f - FILL
              // p - PREFERRED
              // vs - vertical space between labels and text fields
              // vg - vertical gap between form elements
              // hg - horizontal gap between form elements
              double b= 10;
              double f= TableLayout.FILL;
              double p= TableLayout.PREFERRED;
              double vs= 5;
              double vg= 10;
              double hg= 10;
              double size[][]= { { f }, { // our column sizes
                   layoutPreference }}; // our row sizes
              layout= new TableLayout(size);
              setLayout(layout);
              // now we add in our starter panel
              add(panel, "0,0");
        public void add(CollapsiblePanel panel, double layoutPreference)
              // we need to add our panel into our layout
            int rowToAdd = layout.getNumRow();
            layout.insertRow(rowToAdd, layoutPreference);
            add(panel, "0," + rowToAdd);
    }

  • Flash Builder custom code folding

    I've just donwloaded the new CC versions and will possibly be buying the subscription at the end of this month.  I was previously using CS4 versions.
    One thing I noticed though, is that the custom code folding options in the Flash CC actionscript editor are gone, you can now only collapse entire functions.  This remains true for flash builder as well.
    So is there any way to collapse custom regions in flash builder instead of just entire functions?  I'm working on a flash MMO and I've got over 10,000+ lines of code.  Being able to collapse only functions simply doesn't cut it.  It really hinders my development time as I have to scroll through masses of code in order to get to what I need.  It's also much much more confusing looking at thousands of lines of code that I don't need to see at the moment.  Visual studio has a way of defining regions by typing "#region" and "#endregion" in the area you wish to collapse.  Is there anything I can do about this?  This is a very very important feature (at least for me) that I'm not sure why it was left out, or I am unable to find it.
    Thanks.

    I've just donwloaded the new CC versions and will possibly be buying the subscription at the end of this month.  I was previously using CS4 versions.
    One thing I noticed though, is that the custom code folding options in the Flash CC actionscript editor are gone, you can now only collapse entire functions.  This remains true for flash builder as well.
    So is there any way to collapse custom regions in flash builder instead of just entire functions?  I'm working on a flash MMO and I've got over 10,000+ lines of code.  Being able to collapse only functions simply doesn't cut it.  It really hinders my development time as I have to scroll through masses of code in order to get to what I need.  It's also much much more confusing looking at thousands of lines of code that I don't need to see at the moment.  Visual studio has a way of defining regions by typing "#region" and "#endregion" in the area you wish to collapse.  Is there anything I can do about this?  This is a very very important feature (at least for me) that I'm not sure why it was left out, or I am unable to find it.
    Thanks.

  • Why code fold messed up by using cloned document ? (NetBeans 6.9)

    When I use cloned document, I find the user defined code fold is messed up.
    How to switch system auto producing code fold?
    [NetBeans6.9CodeFold|http://robertsong.myweb.hinet.net/images/NetBeans6.9CodeFold.JPG]
    [NetBeans6.9CodeFold2|http://robertsong.myweb.hinet.net/images/NetBeans6.9CodeFold2.JPG]
    Edited by: Robertsong on Aug 1, 2010 8:24 AM

    Sorry, I think is my orignal setting...

  • BUG? Code folding is unreliable.

    Code folding for PL/SQL does not work consistently.
    Some blocks won't fold although inner blocks can. When I click on the [-] for a non-folding block, all the [-] below that point in the file disappear.
    Hovering over the [-] shows that for blocks which don't fold, the scope of the block is only a single line, while for blocks which do fold, the scope is shown correctly.

    CREATE OR REPLACE
    PACKAGE BODY "CAP_PLUGINS" AS
    -- $Header: h:\\cvs/capmgmt/ddl/cap_plugins.pkb,v 1.3 2005/08/30 10:41:38 jim.smith Exp $
    -- $Log: cap_plugins.pkb,v $
    -- Revision 1.3  2005/08/30 10:41:38  jim.smith
    -- Implemented do_segment_space procedure
    -- Revision 1.2  2005/08/04 13:51:28  jim.smith
    -- Modified to ues new tablesructures
    -- Revision 1.1  2005/08/04 12:14:26  jim.smith
    -- Initial versions
    -- =======================================================================
    procedure do_table_counts(rundate in date,collection_name in varchar2,schema in varchar2) is
    type thingy is record (
              table_name varchar2(30),
              object_name varchar2(30),
              object_id number);
    type tablelist is table of thingy;
    tlist tablelist;
    collection_id number;
    new_co_id number;
    stmt varchar2(100);
    stat_rec collected_stat%rowtype;
    tcount number;
    begin
      -- FIRST GET THE collection id
      begin
        select coll_id
        into collection_id
        from collection
        where coll_name = collection_name;
      exception
        WHEN no_data_found then
          return;
        WHEN OTHERS THEN RAISE;
      end;
      -- get the list of tables
      -- including tables which are not in collection_objects
      begin
        select table_name,co_name,co_id
        bulk collect
        into tlist
        from dba_tables
          left outer join ( SELECT co_name ,co_id
                          from collection_objects
                            inner join collection
                            on co_coll_id=coll_id
                          where coLL_object_type='TABLE'
                          and coll_name=collection_name)
        on table_name=co_name
        where owner=schema;
      exception
        when no_data_found then
          return;
        when others then
          raise;
      end;
      --  Now process the list
      for i in tlist.first..tlist.last
      loop
        -- if the table isn't already in the collection, add it
        if tlist(i).object_name is null then
         elx_capmgmt.create_collection_object(collection_id,tlist(i).table_name,tlist(i).table_name,new_co_id);
        else
         new_co_id:=tlist(i).object_id;
        end if;
        -- collect the stats
        begin
        stmt:='select count(*)  from '||schema||'.'||tlist(i).table_name;
        execute immediate(stmt) into tcount;
        exception
          when others then
            raise;
        end;
        stat_rec.cs_co_id:=new_co_id;
        stat_rec.cs_timestamp:=rundate;
        stat_rec.cs_stat_value:=tcount;
        elx_capmgmt.CREATE_STATISTIC(stat_rec);
      end loop;
      commit;
    end;
    procedure do_tablespace_size ( rundate in date, collection_name in varchar2 ) is
    collection_id number ;
    new_co_id number;
    stat_rec collected_stat%rowtype;
    cursor tablespace_size is
    select * from (
      SELECT T.TABLESPACE_NAME TBLSPC,
             ROUND(sum(T.BYTES)) TOTAL
      from  (select * from DBA_DATA_FILES union select * from dba_temp_files) T
       GROUP BY  TABLESPACE_NAME
       ) left outer join ( SELECT coll_id,co_id,co_name
                          from collection_objects
                            inner join collection
                            on co_coll_id=coll_id
                          where coll_name=collection_name)
        on tblspc = co_name;
    ts2 tablespace_size%rowtype;
    begin
      -- FIRST GET THE collection id
      begin
        select coll_id
        into collection_id
        from collection
        where coll_name = collection_name;
      exception
        WHEN no_data_found then
          return;
        WHEN OTHERS THEN RAISE;
      end;
      -- now get the data
      begin
        for ts in tablespace_size
        loop
          ts2:=ts;
          -- if the tablespace is not part of the collection, add it
          if ts.co_id is null then
            elx_capmgmt.create_collection_object(collection_id,ts.tblspc,ts.tblspc,new_co_id);
          else
            new_co_id:=ts.co_id;
          end if;
          -- now load the statistics
          stat_rec.cs_co_id:=new_co_id;
          stat_rec.cs_timestamp:=rundate;
          stat_rec.cs_stat_value:=ts.total;
          elx_capmgmt.create_statistic(stat_rec);
        end loop;
      exception
        when dup_val_on_index then
          return;
        when others then
          raise;
      end;
    end;
    procedure do_tablespace_usage ( rundate in date, collection_name in varchar2  ) is
    cursor tablespace_usage  is
    select * from (
      SELECT T.TABLESPACE_NAME TBLSPC,
             ROUND(sum(T.BYTES)) TOTAL
      from  DBA_segments  T
       GROUP BY  TABLESPACE_NAME
       ) left outer join ( SELECT coll_id,co_id,co_name
                          from collection_objects
                            inner join collection
                            on co_coll_id=coll_id
                          where coll_name=collection_name)
        on tblspc = co_name;
    collection_id number ;
    new_co_id number;
    stat_rec collected_stat%rowtype;
    begin
      -- FIRST GET THE collection id
      begin
        select coll_id
        into collection_id
        from collection
        where coll_name = collection_name;
      exception
        WHEN OTHERS THEN RAISE;
      end;
      -- now get the data
      begin
        for ts in tablespace_usage
        loop
          -- if the tablespace is not part of the collection, add it
          if ts.co_id is null then
            elx_capmgmt.create_collection_object(collection_id,ts.tblspc,ts.tblspc,new_co_id);
          else
            new_co_id:=ts.co_id;
          end if;
          -- now load the statistics
          stat_rec.cs_co_id:=new_co_id;
          stat_rec.cs_timestamp:=rundate;
          stat_rec.cs_stat_value:=ts.total;
          elx_capmgmt.create_statistic(stat_rec);
        end loop;
      exception
        when others then raise;
      end;
    end;
    procedure do_tablespace_free ( rundate in date, collection_name in varchar2  ) is
    cursor tablespace_free  is
    select * from (
      SELECT T.TABLESPACE_NAME TBLSPC,
             ROUND(sum(T.BYTES)) TOTAL
      from  DBA_free_space  T
       GROUP BY  TABLESPACE_NAME
       ) left outer join ( SELECT coll_id,co_id,co_name
                          from collection_objects
                            inner join collection
                            on co_coll_id=coll_id
                          where coll_name=collection_name)
        on tblspc = co_name;
    collection_id number ;
    new_co_id number;
    stat_rec collected_stat%rowtype;
    begin
      -- FIRST GET THE collection id
      begin
        select coll_id
        into collection_id
        from collection
        where coll_name = collection_name;
      exception
        WHEN OTHERS THEN RAISE;
      end;
      -- now get the data
      begin
        for ts in tablespace_free
        loop
          -- if the tablespace is not part of the collection, add it
          if ts.co_id is null then
            elx_capmgmt.create_collection_object(collection_id,ts.tblspc,ts.tblspc,new_co_id);
          else
            new_co_id:=ts.co_id;
          end if;
          -- now load the statistics
          stat_rec.cs_co_id:=new_co_id;
          stat_rec.cs_timestamp:=rundate;
          stat_rec.cs_stat_value:=ts.total;
          elx_capmgmt.create_statistic(stat_rec);
        end loop;
      exception
        when others then raise;
      end;
    end;
    procedure do_tablespaces(rundate in date) is
      running_job_id number:=-1;
    begin
      elx_utilities.make_job_log_entry(running_job_id,elx_utilities.STAGE_ENTRY,0,'Capmgmt.do_tablespace_size','0');
      do_tablespace_size(rundate,'TBLSPCSIZE');
      elx_utilities.make_job_log_entry(running_job_id,elx_utilities.STAGE_ENTRY,0,'Capmgmt.do_tablespace_free','0');
      do_tablespace_free(rundate,'TBLSPCFREE');
      elx_utilities.make_job_log_entry(running_job_id,elx_utilities.STAGE_ENTRY,0,'Capmgmt.do_tablespace_used','0');
      do_tablespace_usage(rundate,'TBLSPCUSED');
      commit;
    end;
    procedure do_segment_space(rundate in date,collection_name in varchar2,schema in varchar2) is
    type thingy is record (
              segment_name varchar2(30),
              total_size number,
              coll_id number,
              object_id number,
              object_name varchar2(30));
    type segmentlist is table of thingy;
    slist segmentlist;
    collection_id number;
    new_co_id number;
    stat_rec collected_stat%rowtype;
    begin
      -- FIRST GET THE collection id
      begin
        select coll_id
        into collection_id
        from collection
        where coll_name = collection_name;
      exception
        WHEN no_data_found then
          return;
        WHEN OTHERS THEN RAISE;
      end;
      begin
        select *
        bulk collect
        into slist
        from ( select segment_name, sum(size2 ) totalsize
        from (     select segment_name,' ',segment_type,bytes size2
              from dba_segments
              where owner=SCHEMA
              and segment_type='TABLE'
              union
              select i.table_name,segment_name,segment_type,s.bytes size2
              from dba_segments s
                inner join dba_indexes i
                on segment_name=index_name
              where s.owner=SCHEMA
              and segment_type='INDEX')
      group by segment_name )
      left outer join ( SELECT coll_id,co_id,co_name
                      from collection_objects
                        inner join collection
                        on co_coll_id=coll_id
                      where coLL_object_type='SEGMENT'
                      and coll_name=collection_name)
      on segment_name = co_name;
      exception
        when others
          then raise;
      end;
      for i in slist.first..slist.last
      loop
        -- if the table isn't already in the collection, add it
        if slist(i).object_name is null then
         elx_capmgmt.create_collection_object(collection_id,slist(i).segment_name,slist(i).segment_name,new_co_id);
        else
         new_co_id:=slist(i).object_id;
        end if;
        -- collect the stats
        stat_rec.cs_co_id:=new_co_id;
        stat_rec.cs_timestamp:=rundate;
        stat_rec.cs_stat_value:=slist(i).total_size;
        elx_capmgmt.CREATE_STATISTIC(stat_rec);
      end loop;
    null;
    end;
    END;

  • Folding a form (like code folds)

    Hi all,
    I was thinking of creating a form which would display numerous panels. However, what I was thinking of doing is giving the user the option of displaying the full panel(expanded), or just the panel name(collapsed) by clicking '+' or '-'.
    I was thinking the best way to do it would be to assign the JPanels to nodes on a tree, but am not sure if this is the correct way to do this. Is this how the 'code fold' feature in NetBeans is implemented? If anyone has experience/thoughts on this, feedback would be appreciated.
    Thanks,
    Mike

    Hi,
    I am not sure that I am giving the correct answer to your question, but I think it might help.
    I think you can do this without using a JTree.
    You can add small image containing + sign to the top left of right hand corner of all your JPanels. Then once the user clicks the + image of one JPanel increase its height and decrease the height of previously unfolded JPanel. and change the + image of new unfolded JPanel to an image comtaining - sign.
    Chamal.

  • Flex code folding

    I would like to be able to "code fold/collapse" all of my functions, however I only get the small + and - symbols where flex puts them, ie controlling large blocks of code such as my script and application tags.
    Can you customizse where the + and - symbols appear. Can you make every function have the ability to "code fold(collapse" ?
    Thanks for any help.

    You can turn on and off code folding in Window - Perferences - Flex - Editors - "Enable code folding" checkbox.
    Although the help system indicates you can do code folding in Flex Builder, it does not seem to work.

  • Implement Code folding

    I know that there are several topics about how to implement code folding, but no one is giving a solution.
    Has anyone some usable and more important useful code snippets?
    My goal is to implement code folding (collapsing) into JTextPane (better way into any JTextComponent), like Eclipse, NetBeans or JEdit does ...
    Thanks for any help ....

    i also want to implement such functionality, but currently i have no clue where to start, could you post some relevant parts of your code?

  • Code Folding - Applescript issue ?

    can't find this anywhere as an issue discussed
    I must be special
    this is happening on Xcode 3.1.2 on 10.5.6 intel
    I make an Applescript Application with a few handlers and a few if then statements
    when the if then statements are on one line they seem to screw up the code folding and the list of available handlers
    I have a small screenshot of it here http://www.metzinger.us/Pictures/code_folding.jpg
    the Xcode window thinks handler 4 is nested in handler 1 and doesn't even mention the other two
    I can fix the issue by expanding my if then statements to multiple lines with an end line
    is there something else I can do besides changing all of my if then statements?
    thanks
    .bill

    bump whoops
    be first to answer this and win a prize
    still baffled here
    I've reproduced this on another xcode 3.1.2
    make new applescript application
    paste this as a script
    if 1 = 2 then say "dooh"
    if 3 = 4 then
    say "dooh"
    end if
    the "code folding" feature of xcode is confused by the first line
    having an if then statement with no "end" bums it out
    seems like I'm missing something simple here
    is this a known bug or am I just bugging you?
    thanks
    .bill

  • Implementing Code Folding

    Hi All
    I want to develop code folding for methods in java File
    when displayed in jeditorpane or jtextpane.
    I am not very sure as to how implement it.
    Anybody having any ideas as to how to go about it...
    Any references sure will be nice
    Thanks

    I have been looking at the SDK javadoc and it looks like I have to create an implementation of the AbstractCodeFoldingPlugin. This will also require a CodeFoldingMargin, CodeFoldingProvider and CodeFoldingModel. The model looks like it is made up of FoldBlock objects. I have started down this path and I am creating a provider that parses the document to create a model. However, I am not sure how to install and use the plugin with my addin. Also, I am not sure how the document and the model will stay in sync, I do not want to parse the entire document for every change. Hopefully there is someone out there who has worked thorough this and could give me some tips.
    Thank you,
    Todd

  • Code Folding Colors 10.1.3 EA

    Hi
    It doesn't seem possible to set the colors for the folding 'tooltip' popup that shows the folded code and also the folding margin colors don't seem to be changable. I always operate with a modified version of the 'twilight' scheme and some icons or items always seem unsupported for this. The cursor should be made white by default when selecting this scheme. The folding + icons can't be black either. I'm not using folding now due to this.
    Regards.

    OK, some new discoveries...
    It seems that JDev's ant integration can't correctly parse the following ant import/inheritance setup that I have, as follows:
    build.xml snippet (I point JDev to this file)
    <property name="shared.home" value="../client-shared"/>
    <import file="${shared.home}/clientbuild.xml"/>
    clientbuild.xml snippet (which is what is imported into build.xml above)
    <dirname property="clientbuild.basedir"
    file="${ant.file.clientbuild}"/>
    <import file="${clientbuild.basedir}/commonbuild.xml"/>
    JDev seems unable to correcly deal with my dirname task in clientbuild.xml. If I change the import in clientbuild.xml to be the following then I am able to see the imported targets in JDev: <import file="commonbuild.xml"/>. We need to leverage the use of dirname though, for purposes I won't go into here.
    Any ideas?
    Thanks,
    Chris

  • How to increase Code folding tag width

    Is there a way to increase the "hint" size of a folded (collapsed) code tag.  I only get about 4 letters which is not enough to tell me what the folded code is.
    Thanks !

    Well that's too bad,  the tag doesn't tell you enough to be useful as a placeholder and you have to select the tag for the tooltip to work.  They really need a pref to set the width.  This just makes this feature all but useless to me.

  • Code folding idea

    I think you should be able to do the following:
    1) Click any paired parenthesis, and then click "FOLD" and it would hide all the code between em as *FOLDED*
    2) Allow you to comment out what is in parenthesis.  This is more complex than /* and */ because you cannot nest /* and */

    I think you should be able to do the following:
    1) Click any paired parenthesis, and then click "FOLD" and it would hide all the code between em as *FOLDED*
    2) Allow you to comment out what is in parenthesis.  This is more complex than /* and */ because you cannot nest /* and */

  • Extension using code folding editor

    Hi All
    I have been looking thorugh the 11g extension javadoc to try and figure out how to create a textarea or editor which can do codefolding. I have not been able to find this in the extension examples either.
    Which classes and/or interfaces do I need to look at to do this. I only need a very simple text panel as all I basically have is a list of strings which I would like to be an individual foldable codeblock.
    Any chance someone could point me in the right direction?
    Regards
    Jesper

    Hi Jesper,
    We have subclassed JTextArea into oracle.javatools.editor.BasicEditorPane, this allows the installation of helper 'plugins' to boost the functionality.
    We also have a folding mechanism, the abstract form of it is in oracle.javatools.editor.folding. Sub-class AbstractFoldingPlugin and install it via BasicEditorPane.installPlugin(...). You'll have to supply a model and definitions of what a foldable block is in your document.
    The folding package is the place to start.

Maybe you are looking for