refactory: added UI removed from core plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / xml / ui / internal / editor / XMLDocumentSetupParticipant.java
1 /*
2  * Copyright (c) 2004 Christopher Lenz 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  *     Christopher Lenz - initial implementation
10  * 
11  * $Id: XMLDocumentSetupParticipant.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
12  */
13
14 package net.sourceforge.phpeclipse.xml.ui.internal.editor;
15
16 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
17 import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
18
19 import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
20 import org.eclipse.jface.text.IDocument;
21 import org.eclipse.jface.text.IDocumentPartitioner;
22
23 /**
24  * Document setup participant that sets up the CSS specific partitioning.
25  */
26 public class XMLDocumentSetupParticipant implements IDocumentSetupParticipant {
27
28         /*
29          * @see IDocumentSetupParticipant#setup(IDocument)
30          */
31         public void setup(IDocument document) {
32                 if (document != null) {
33                         XMLTextTools tools = XMLPlugin.getDefault().getXMLTextTools();
34                         IDocumentPartitioner partitioner = tools.createXMLPartitioner();
35                         partitioner.connect(document);
36                         document.setDocumentPartitioner(partitioner);
37                 }
38         }
39
40 }