01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 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.ui.examples.javaeditor;
11:
12: import org.eclipse.jface.text.rules.RuleBasedScanner;
13:
14: import org.eclipse.ui.examples.javaeditor.java.JavaCodeScanner;
15: import org.eclipse.ui.examples.javaeditor.javadoc.JavaDocScanner;
16: import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
17: import org.eclipse.ui.plugin.AbstractUIPlugin;
18:
19: /**
20: * The example java editor plug-in class.
21: *
22: * @since 3.0
23: */
24: public class JavaEditorExamplePlugin extends AbstractUIPlugin {
25:
26: public final static String JAVA_PARTITIONING = "__java_example_partitioning"; //$NON-NLS-1$
27:
28: private static JavaEditorExamplePlugin fgInstance;
29: private JavaPartitionScanner fPartitionScanner;
30: private JavaColorProvider fColorProvider;
31: private JavaCodeScanner fCodeScanner;
32: private JavaDocScanner fDocScanner;
33:
34: /**
35: * Creates a new plug-in instance.
36: */
37: public JavaEditorExamplePlugin() {
38: fgInstance = this ;
39: }
40:
41: /**
42: * Returns the default plug-in instance.
43: *
44: * @return the default plug-in instance
45: */
46: public static JavaEditorExamplePlugin getDefault() {
47: return fgInstance;
48: }
49:
50: /**
51: * Return a scanner for creating Java partitions.
52: *
53: * @return a scanner for creating Java partitions
54: */
55: public JavaPartitionScanner getJavaPartitionScanner() {
56: if (fPartitionScanner == null)
57: fPartitionScanner = new JavaPartitionScanner();
58: return fPartitionScanner;
59: }
60:
61: /**
62: * Returns the singleton Java code scanner.
63: *
64: * @return the singleton Java code scanner
65: */
66: public RuleBasedScanner getJavaCodeScanner() {
67: if (fCodeScanner == null)
68: fCodeScanner = new JavaCodeScanner(getJavaColorProvider());
69: return fCodeScanner;
70: }
71:
72: /**
73: * Returns the singleton Java color provider.
74: *
75: * @return the singleton Java color provider
76: */
77: public JavaColorProvider getJavaColorProvider() {
78: if (fColorProvider == null)
79: fColorProvider = new JavaColorProvider();
80: return fColorProvider;
81: }
82:
83: /**
84: * Returns the singleton Javadoc scanner.
85: *
86: * @return the singleton Javadoc scanner
87: */
88: public RuleBasedScanner getJavaDocScanner() {
89: if (fDocScanner == null)
90: fDocScanner = new JavaDocScanner(fColorProvider);
91: return fDocScanner;
92: }
93: }
|