2 * Copyright (c) 2002-2004 Widespace, OU and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Igor Malinin - initial contribution
11 * $Id: DTDDocumentProvider.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
14 package net.sourceforge.phpeclipse.xml.ui.internal.text;
16 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
18 import org.eclipse.core.runtime.CoreException;
19 import org.eclipse.jface.text.IDocument;
20 import org.eclipse.jface.text.IDocumentPartitioner;
23 * DTD document provider.
25 * @author Igor Malinin
27 public class DTDDocumentProvider extends AbstractDocumentProvider {
29 * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object)
31 protected IDocument createDocument(Object element) throws CoreException {
32 IDocument document = super.createDocument(element);
33 if (document != null) {
34 IDocumentPartitioner partitioner = XMLPlugin.getDefault()
35 .getDTDTextTools().createDTDPartitioner();
37 if (partitioner != null) {
38 partitioner.connect(document);
39 document.setDocumentPartitioner(partitioner);