*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse.xml.ui / src / net / sourceforge / phpeclipse / xml / ui / internal / text / DTDDocumentProvider.java
1 /*
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
7  *
8  * Contributors:
9  *     Igor Malinin - initial contribution
10  *
11  * $Id: DTDDocumentProvider.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
12  */
13
14 package net.sourceforge.phpeclipse.xml.ui.internal.text;
15
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.jface.text.IDocument;
18 import org.eclipse.jface.text.IDocumentPartitioner;
19
20 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
21
22
23 /**
24  * DTD document provider.
25  * 
26  * @author Igor Malinin
27  */
28 public class DTDDocumentProvider extends AbstractDocumentProvider {
29         /*
30          * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object)
31          */
32         protected IDocument createDocument( Object element ) throws CoreException {
33                 IDocument document = super.createDocument( element );
34                 if ( document != null ) {
35                         IDocumentPartitioner partitioner = XMLPlugin
36                                 .getDefault().getDTDTextTools().createDTDPartitioner();
37
38                         if ( partitioner != null ) {
39                                 partitioner.connect( document );
40                                 document.setDocumentPartitioner( partitioner );
41                         }
42                 }
43
44                 return document;
45         }
46 }