01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.context;
11:
12: import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
13: import org.eclipse.jface.text.IDocument;
14: import org.eclipse.jface.text.IDocumentPartitioner;
15: import org.eclipse.jface.text.rules.FastPartitioner;
16: import org.eclipse.pde.internal.ui.editor.text.ManifestPartitionScanner;
17:
18: public class ManifestDocumentSetupParticipant implements
19: 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(),
31: ManifestPartitionScanner.PARTITIONS);
32: }
33:
34: }
|