diff options
author | Dani Megert | 2011-01-04 14:55:35 +0000 |
---|---|---|
committer | Dani Megert | 2011-01-04 14:55:35 +0000 |
commit | 171e9eba519d3fca65eea95e8a7be26138aaa320 (patch) | |
tree | 54adbc83fbd37417a18c7eaa048ca6cad6c7d0fc /org.eclipse.ui.examples.javaeditor | |
parent | 9d2ce079dd7591a7246bec843aaba9df29fde724 (diff) | |
download | eclipse.platform.text-171e9eba519d3fca65eea95e8a7be26138aaa320.tar.gz eclipse.platform.text-171e9eba519d3fca65eea95e8a7be26138aaa320.tar.xz eclipse.platform.text-171e9eba519d3fca65eea95e8a7be26138aaa320.zip |
Added some helpers.v20110420
Diffstat (limited to 'org.eclipse.ui.examples.javaeditor')
-rw-r--r-- | org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java index 71183ab2305..7fbb42b43a0 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.ui.examples.javaeditor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + import org.eclipse.jface.text.rules.RuleBasedScanner; import org.eclipse.ui.examples.javaeditor.java.JavaCodeScanner; @@ -17,19 +20,26 @@ import org.eclipse.ui.examples.javaeditor.javadoc.JavaDocScanner; import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider; import org.eclipse.ui.plugin.AbstractUIPlugin; + /** * The example java editor plug-in class. - * + * * @since 3.0 */ public class JavaEditorExamplePlugin extends AbstractUIPlugin { - public final static String JAVA_PARTITIONING= "__java_example_partitioning"; //$NON-NLS-1$ + public final static String JAVA_PARTITIONING= "__java_example_partitioning"; //$NON-NLS-1$ + + public static final String PLUGIN_ID= "org.eclipse.ui.examples.javaeditor"; //$NON-NLS-1$ private static JavaEditorExamplePlugin fgInstance; + private JavaPartitionScanner fPartitionScanner; + private JavaColorProvider fColorProvider; + private JavaCodeScanner fCodeScanner; + private JavaDocScanner fDocScanner; /** @@ -41,7 +51,7 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin { /** * Returns the default plug-in instance. - * + * * @return the default plug-in instance */ public static JavaEditorExamplePlugin getDefault() { @@ -50,10 +60,10 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin { /** * Return a scanner for creating Java partitions. - * + * * @return a scanner for creating Java partitions */ - public JavaPartitionScanner getJavaPartitionScanner() { + public JavaPartitionScanner getJavaPartitionScanner() { if (fPartitionScanner == null) fPartitionScanner= new JavaPartitionScanner(); return fPartitionScanner; @@ -61,34 +71,43 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin { /** * Returns the singleton Java code scanner. - * + * * @return the singleton Java code scanner */ - public RuleBasedScanner getJavaCodeScanner() { - if (fCodeScanner == null) + public RuleBasedScanner getJavaCodeScanner() { + if (fCodeScanner == null) fCodeScanner= new JavaCodeScanner(getJavaColorProvider()); return fCodeScanner; } /** * Returns the singleton Java color provider. - * + * * @return the singleton Java color provider */ - public JavaColorProvider getJavaColorProvider() { - if (fColorProvider == null) + public JavaColorProvider getJavaColorProvider() { + if (fColorProvider == null) fColorProvider= new JavaColorProvider(); return fColorProvider; } /** * Returns the singleton Javadoc scanner. - * + * * @return the singleton Javadoc scanner */ - public RuleBasedScanner getJavaDocScanner() { - if (fDocScanner == null) + public RuleBasedScanner getJavaDocScanner() { + if (fDocScanner == null) fDocScanner= new JavaDocScanner(fColorProvider); return fDocScanner; } + + public static void log(IStatus status) { + getDefault().getLog().log(status); + } + + public static void log(Throwable e) { + log(new Status(IStatus.ERROR, PLUGIN_ID, 0, "Java editor example: internal error", e)); //$NON-NLS-1$ + } + } |