Search in sources :

Example 1 with Fold

use of org.fife.ui.rsyntaxtextarea.folding.Fold in project knime-core by knime.

the class GuardedSectionsFoldParser method getFolds.

/**
 * {@inheritDoc}
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List getFolds(final RSyntaxTextArea textArea) {
    List folds = new ArrayList();
    GuardedDocument doc = (GuardedDocument) textArea.getDocument();
    for (String name : doc.getGuardedSections()) {
        GuardedSection guard = doc.getGuardedSection(name);
        Fold fold;
        try {
            fold = new Fold(FoldType.FOLD_TYPE_USER_DEFINED_MIN, textArea, guard.getStart().getOffset());
            fold.setEndOffset(guard.getEnd().getOffset());
            folds.add(fold);
        } catch (BadLocationException e) {
            LOGGER.debug(e.getMessage());
        }
    }
    return folds;
}
Also used : Fold(org.fife.ui.rsyntaxtextarea.folding.Fold) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BadLocationException(javax.swing.text.BadLocationException)

Example 2 with Fold

use of org.fife.ui.rsyntaxtextarea.folding.Fold in project fql by CategoricalData.

the class CodeEditor method foldAll.

public void foldAll(boolean b) {
    int i = topArea.getFoldManager().getFoldCount();
    for (int j = 0; j < i; j++) {
        Fold fold = topArea.getFoldManager().getFold(j);
        fold.setCollapsed(b);
    }
    setCaretPos(topArea.getCaretPosition());
    topArea.revalidate();
    sp.revalidate();
}
Also used : Fold(org.fife.ui.rsyntaxtextarea.folding.Fold)

Example 3 with Fold

use of org.fife.ui.rsyntaxtextarea.folding.Fold in project knime-core by knime.

the class JavaSnippetNodeDialog method collapseAllFolds.

/* Collapse all folds */
private void collapseAllFolds() {
    final FoldManager foldManager = m_snippetTextArea.getFoldManager();
    final int foldCount = foldManager.getFoldCount();
    for (int i = 0; i < foldCount; i++) {
        final Fold fold = foldManager.getFold(i);
        fold.setCollapsed(true);
    }
}
Also used : Fold(org.fife.ui.rsyntaxtextarea.folding.Fold) FoldManager(org.fife.ui.rsyntaxtextarea.folding.FoldManager)

Aggregations

Fold (org.fife.ui.rsyntaxtextarea.folding.Fold)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BadLocationException (javax.swing.text.BadLocationException)1 FoldManager (org.fife.ui.rsyntaxtextarea.folding.FoldManager)1