org.gjt.sp.jedit.buffer
Class FoldHandler

java.lang.Object
  |
  +--org.gjt.sp.jedit.buffer.FoldHandler
Direct Known Subclasses:
DummyFoldHandler, ExplicitFoldHandler, IndentFoldHandler

public abstract class FoldHandler
extends java.lang.Object

Interface for obtaining the fold level of a specified line.

Plugins can add and remove fold handlers using the registerFoldHandler(FoldHandler) and unregisterFoldHandler(FoldHandler) methods.

Since:
jEdit 4.0pre1
Version:
$Id: FoldHandler.java,v 1.7 2003/02/08 20:13:27 spestov Exp $
Author:
Slava Pestov

Constructor Summary
protected FoldHandler(java.lang.String name)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns if the specified fold handler is equal to this one.
static FoldHandler getFoldHandler(java.lang.String name)
          Returns the fold handler with the specified name, or null if there is no registered handler with that name.
static FoldHandler[] getFoldHandlers()
          Returns an array containing the list of registered fold handlers
abstract  int getFoldLevel(Buffer buffer, int lineIndex, javax.swing.text.Segment seg)
          Returns the fold level of the specified line.
static java.lang.String[] getFoldModes()
          Returns an array containing the names of all registered fold handlers
 java.lang.String getName()
          Returns the internal name of this FoldHandler
static void registerFoldHandler(FoldHandler handler)
          Adds a fold handler to the list of registered handlers.
static void unregisterFoldHandler(FoldHandler handler)
          Removes a fold handler from the list of registered handlers.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FoldHandler

protected FoldHandler(java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Returns the internal name of this FoldHandler

Returns:
The internal name of this FoldHandler
Since:
jEdit 4.0pre6

getFoldLevel

public abstract int getFoldLevel(Buffer buffer,
                                 int lineIndex,
                                 javax.swing.text.Segment seg)
Returns the fold level of the specified line.

Parameters:
buffer - The buffer in question
lineIndex - The line index
seg - A segment the fold handler can use to obtain any text from the buffer, if necessary
Returns:
The fold level of the specified line
Since:
jEdit 4.0pre1

equals

public boolean equals(java.lang.Object o)
Returns if the specified fold handler is equal to this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object

registerFoldHandler

public static void registerFoldHandler(FoldHandler handler)
Adds a fold handler to the list of registered handlers. Typically this will be called from a plugin's EditPlugin.start() method.

Parameters:
handler - The fold handler to add
Since:
jEdit 4.0pre6

unregisterFoldHandler

public static void unregisterFoldHandler(FoldHandler handler)
Removes a fold handler from the list of registered handlers. Typically this will be called from a plugin's EditPlugin.stop() method.

Parameters:
handler - The fold handler to add
Since:
jEdit 4.1pre2

getFoldHandlers

public static FoldHandler[] getFoldHandlers()
Returns an array containing the list of registered fold handlers

Since:
jEdit 4.0pre6

getFoldHandler

public static FoldHandler getFoldHandler(java.lang.String name)
Returns the fold handler with the specified name, or null if there is no registered handler with that name.

Parameters:
name - The name of the desired fold handler
Since:
jEdit 4.0pre6

getFoldModes

public static java.lang.String[] getFoldModes()
Returns an array containing the names of all registered fold handlers

Since:
jEdit 4.0pre6