/*
* Copyright (c) 2005- michael lawley and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation
* which accompanies this distribution, and is available by writing to
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Contributors:
* michael lawley
*
*
*
*/
package tefkat.plugin;
import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.FastPartitioner;
/**
* @author lawley
*
*/
public class TefkatDocumentSetupParticipant implements IDocumentSetupParticipant {
/* (non-Javadoc)
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
*/
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
IDocumentPartitioner partitioner = new FastPartitioner(TefkatPlugin.getPlugin().getTefkatPartitionScanner(), TefkatPartitionScanner.TEFKAT_PARTITION_TYPES);
extension3.setDocumentPartitioner(TefkatPlugin.TEFKAT_PARTITIONING, partitioner);
partitioner.connect(document);
}
}
}