01: /*******************************************************************************
02: * Copyright (c) 2000, 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.text;
11:
12: import java.util.ArrayList;
13:
14: import org.eclipse.jface.text.rules.IPredicateRule;
15: import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
16: import org.eclipse.jface.text.rules.SingleLineRule;
17: import org.eclipse.jface.text.rules.Token;
18:
19: public class ManifestPartitionScanner extends RuleBasedPartitionScanner {
20:
21: public static final String MANIFEST_HEADER_VALUE = "__mf_bundle_header_value"; //$NON-NLS-1$
22:
23: public static final String MANIFEST_FILE_PARTITIONING = "___mf_partitioning"; //$NON-NLS-1$
24:
25: public static final String[] PARTITIONS = new String[] { MANIFEST_HEADER_VALUE };
26:
27: public ManifestPartitionScanner() {
28:
29: Token value = new Token(MANIFEST_HEADER_VALUE);
30: ArrayList rules = new ArrayList();
31: rules
32: .add(new SingleLineRule(
33: "=", null, value, '\\', true, true)); //$NON-NLS-1$
34: rules
35: .add(new SingleLineRule(
36: ":", null, value, '\\', true, true)); //$NON-NLS-1$
37: rules
38: .add(new SingleLineRule(
39: " ", null, value, '\\', true, true)); //$NON-NLS-1$
40: rules.add(new SingleLineRule(
41: "\t", null, value, '\\', true, true)); //$NON-NLS-1$
42: setPredicateRules((IPredicateRule[]) rules
43: .toArray(new IPredicateRule[rules.size()]));
44: }
45:
46: }
|