*/
public static List<FoldingEntry> getMarks(IDocument doc, SimpleNode ast) {
List<FoldingEntry> ret = new ArrayList<FoldingEntry>();
CodeFoldingVisitor visitor = CodeFoldingVisitor.create(ast);
//(re) insert annotations.
List<Class> elementList = new ArrayList<Class>();
IPreferenceStore prefs = getPreferences();
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_IMPORTS)) {
elementList.add(Import.class);
elementList.add(ImportFrom.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_CLASSDEF)) {
elementList.add(ClassDef.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_FUNCTIONDEF)) {
elementList.add(FunctionDef.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_STRINGS)) {
elementList.add(Str.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_WHILE)) {
elementList.add(While.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_IF)) {
elementList.add(If.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_FOR)) {
elementList.add(For.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_WITH)) {
elementList.add(With.class);
}
if (prefs.getBoolean(PyDevCodeFoldingPrefPage.FOLD_TRY)) {
elementList.add(TryExcept.class);
elementList.add(TryFinally.class);
}
List<ASTEntry> nodes = visitor.getAsList(elementList.toArray(new Class[elementList.size()]));
for (ASTEntry entry : nodes) {
createFoldingEntries((ASTEntryWithChildren) entry, ret);
}