info.foldLevel = whitespace;
if(info.foldLevel != whitespace) { info.foldLevel = whitespace; fireFoldLevelsChanged(line - 1,line - 1); }
	public int getFoldLevel(int line)	{		LineInfo info = lineInfo[line];		if(info.foldLevelValid)			return info.foldLevel;		else		{			// make this configurable!			int tabSize = getTabSize();			Element lineElement = getDefaultRootElement()				.getElement(line);			int start = lineElement.getStartOffset();			try			{				getText(start,lineElement.getEndOffset() - start - 1,seg);			}			catch(BadLocationException bl)			{				Log.log(Log.ERROR,this,bl);			}			int offset = seg.offset;			int count = seg.count;			int whitespace = 0;			if(count == 0)			{				// empty line. inherit previous line's fold level				if(line != 0)					whitespace = getFoldLevel(line - 1);				else					whitespace = 0;			}			else			{loop:				for(int i = 0; i < count; i++)				{					switch(seg.array[offset + i])					{					case ' ':						whitespace++;						break;					case '\t':						whitespace += (tabSize - whitespace % tabSize);						break;					default:						break loop;					}				}			}			info.foldLevel = whitespace;			info.foldLevelValid = true;			return whitespace;		}	}