KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > context > ManifestDocumentSetupParticipant


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.editor.context;
12
13 import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.jface.text.IDocumentPartitioner;
16 import org.eclipse.jface.text.rules.FastPartitioner;
17 import org.eclipse.pde.internal.ui.editor.text.ManifestPartitionScanner;
18
19 public class ManifestDocumentSetupParticipant implements IDocumentSetupParticipant {
20
21     public void setup(IDocument document) {
22         IDocumentPartitioner partitioner = createDocumentPartitioner();
23         if (partitioner != null) {
24             partitioner.connect(document);
25             document.setDocumentPartitioner(partitioner);
26         }
27     }
28     
29     private IDocumentPartitioner createDocumentPartitioner() {
30         return new FastPartitioner(new ManifestPartitionScanner(), ManifestPartitionScanner.PARTITIONS);
31     }
32
33 }
34
Popular Tags