/*
 * Created on Nov 11, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package aspectEditor.editors;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.ui.editors.text.FileDocumentProvider;

public class AspectDocumentProvider extends FileDocumentProvider {

	protected IDocument createDocument(Object element) throws CoreException {
		IDocument document = super.createDocument(element);
		AspectEditor.myDoc = document;
		if (document != null) {
			IDocumentPartitioner partitioner =
				new DefaultPartitioner(
					new AspectPartitionScanner(),
					new String[] {
						AspectPartitionScanner.INPUT_DEFAULT,
						AspectPartitionScanner.INPUT_KEYWORD});
			partitioner.connect(document);
			document.setDocumentPartitioner(partitioner);
		}
		return document;
	}
}