*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse.xml.ui / src / net / sourceforge / phpeclipse / xml / ui / internal / text / DTDDocumentProvider.java
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/DTDDocumentProvider.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/DTDDocumentProvider.java
new file mode 100644 (file)
index 0000000..d03d456
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2004 Widespace, OU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ *     Igor Malinin - initial contribution
+ *
+ * $Id: DTDDocumentProvider.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ */
+
+package net.sourceforge.phpeclipse.xml.ui.internal.text;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+
+import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
+
+
+/**
+ * DTD document provider.
+ * 
+ * @author Igor Malinin
+ */
+public class DTDDocumentProvider extends AbstractDocumentProvider {
+       /*
+        * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object)
+        */
+       protected IDocument createDocument( Object element ) throws CoreException {
+               IDocument document = super.createDocument( element );
+               if ( document != null ) {
+                       IDocumentPartitioner partitioner = XMLPlugin
+                               .getDefault().getDTDTextTools().createDTDPartitioner();
+
+                       if ( partitioner != null ) {
+                               partitioner.connect( document );
+                               document.setDocumentPartitioner( partitioner );
+                       }
+               }
+
+               return document;
+       }
+}