public final class FoldingSupport extends Object
Modifier and Type | Method and Description |
---|---|
static ContentReader |
contentReader(String start,
String terminator,
String stop,
String prefix)
Creates a default implementation of
ContentReader . |
static ContentReader.Factory |
contentReaderFactory(Map m)
A variant of
#defaultReader usable from FS layer. |
static FoldManager |
userFoldManager(String tokenId)
Creates a user-defined fold manager, that processes specific token type.
|
static FoldManagerFactory |
userFoldManagerFactory(Map params)
Creates a user-defined fold manager, that processes specific token type.
|
public static FoldManagerFactory userFoldManagerFactory(Map params)
primaryCategory
starts with a String, which is stored under 'tokenId' key in the params map.
The method is designed to be called from the filesystem layer as follows:
<file name="my-custom-foldmanager.instance">
<attr name="instanceCreate" methodvalue="org.netbeans.api.editor.fold.FoldUtilities.createUserFoldManager"/>
<attr name="tokenid" stringvalue="comment"/>
</file>
map
- the configuration parameters.public static FoldManager userFoldManager(String tokenId)
primaryCategory
starts with tokenId string.
Null
value of 'tokenId' means the default "comment" will be used.tokenId
- filter for prefix of the token's primaryCategory.public static ContentReader contentReader(String start, String terminator, String stop, String prefix)
ContentReader
.
The default implementation is modeled to work with Javadoc-like comments. It will
ignore markers at line start (first non-whitespace) - 'start' parameter. If the reader
encounters the 'stop' regex pattern, it stops scanning and returns null
. Typically
some tags are placed at the end of the doc comment, and they are not informative enough
to put them into folded preview.
Finally, if a suitable content is found, and it contains the 'terminator' pattern,
the content is only returned up to (excluding) the terminator.
Javadoc (PHPdoc) reader can be constructed as defaultReader("*", "\\.", "@");
start
- character sequence, which will be ignored at the beginning of the line. Can be null
terminator
- pattern, which marks the end of the summary line/sentence. Can be null
stop
- content search stop at the 'stop' pattern. Can be null
public static ContentReader.Factory contentReaderFactory(Map m)
#defaultReader
usable from FS layer.
See #defaultReader
documentation for parameter explanation. The
method expects those parameters as keys in the Map (values are all Strings).
An additional entry (key: 'type') is required in the map, it identifies the
FoldType for which the reader should work.m
- configuration parameters for the reader factory.contentReader(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Built on May 31 2023. | Copyright © 2017-2023 Apache Software Foundation. All Rights Reserved.