diff options
3 files changed, 178 insertions, 1 deletions
diff --git a/org.eclipse.core.variables/plugin.xml b/org.eclipse.core.variables/plugin.xml index e8f049149..46996ca7c 100644 --- a/org.eclipse.core.variables/plugin.xml +++ b/org.eclipse.core.variables/plugin.xml @@ -3,7 +3,8 @@ name="%pluginName" version="3.0.0" provider-name="%providerName" - id="org.eclipse.core.variables"> + id="org.eclipse.core.variables" + class= "org.eclipse.core.variables.VariablesPlugin"> <runtime> </runtime> diff --git a/org.eclipse.core.variables/src/VariablesPlugin.java b/org.eclipse.core.variables/src/VariablesPlugin.java new file mode 100644 index 000000000..0d47fde4a --- /dev/null +++ b/org.eclipse.core.variables/src/VariablesPlugin.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; + +/** + * The plug-in runtime class for the Core Variables plug-in. + * @since 3.0 + */ +public class VariablesPlugin extends Plugin { + + /** + * Status code indicating an unexpected internal error. + */ + public static final int INTERNAL_ERROR = 120; + + /** + * The single instance of this plug-in runtime class. + */ + private static VariablesPlugin plugin; + + /** + * Unique identifier constant (value <code>"org.eclipse.core.variables"</code>) + * for the Core Variables plug-in. + */ + public static final String PI_CORE_VARIABLES = "org.eclipse.core.variables"; //$NON-NLS-1$ + + + /** + * Constructs an instance of this plug-in runtime class. + * <p> + * An instance of this plug-in runtime class is automatically created + * when the facilities provided by the Variables plug-in are required. + * <b>Clients must never explicitly instantiate a plug-in runtime class.</b> + * </p> + * + * @param pluginDescriptor the plug-in descriptor for the + * Variables plug-in + */ + public VariablesPlugin(IPluginDescriptor descriptor) { + super(descriptor); + plugin = this; + } + + /** + * Returns this plug-in instance. + * + * @return the single instance of this plug-in runtime class + */ + public static VariablesPlugin getDefault() { + return plugin; + } + + /** + * Logs the specified throwable with this plug-in's log. + * + * @param t throwable to log + */ + public static void log(Throwable t) { + IStatus status= new Status(IStatus.ERROR, PI_CORE_VARIABLES, INTERNAL_ERROR, "Error logged from Core Variables: ", t); //$NON-NLS-1$ + getDefault().getLog().log(status); + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() == null) { + // If the default instance is not yet initialized, + // return a static identifier. This identifier must + // match the plugin id defined in plugin.xml + return PI_CORE_VARIABLES; + } + return getDefault().getDescriptor().getUniqueIdentifier(); + } +} diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java new file mode 100644 index 000000000..1d9dbec32 --- /dev/null +++ b/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.core.variables; + +import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; + +/** + * The plug-in runtime class for the Core Variables plug-in. + * @since 3.0 + */ +public class VariablesPlugin extends Plugin { + + /** + * Status code indicating an unexpected internal error. + */ + public static final int INTERNAL_ERROR = 120; + + /** + * The single instance of this plug-in runtime class. + */ + private static VariablesPlugin plugin; + + /** + * Unique identifier constant (value <code>"org.eclipse.core.variables"</code>) + * for the Core Variables plug-in. + */ + public static final String PI_CORE_VARIABLES = "org.eclipse.core.variables"; //$NON-NLS-1$ + + + /** + * Constructs an instance of this plug-in runtime class. + * <p> + * An instance of this plug-in runtime class is automatically created + * when the facilities provided by the Variables plug-in are required. + * <b>Clients must never explicitly instantiate a plug-in runtime class.</b> + * </p> + * + * @param pluginDescriptor the plug-in descriptor for the + * Variables plug-in + */ + public VariablesPlugin(IPluginDescriptor descriptor) { + super(descriptor); + plugin = this; + } + + /** + * Returns this plug-in instance. + * + * @return the single instance of this plug-in runtime class + */ + public static VariablesPlugin getDefault() { + return plugin; + } + + /** + * Logs the specified throwable with this plug-in's log. + * + * @param t throwable to log + */ + public static void log(Throwable t) { + IStatus status= new Status(IStatus.ERROR, PI_CORE_VARIABLES, INTERNAL_ERROR, "Error logged from Core Variables: ", t); //$NON-NLS-1$ + getDefault().getLog().log(status); + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() == null) { + // If the default instance is not yet initialized, + // return a static identifier. This identifier must + // match the plugin id defined in plugin.xml + return PI_CORE_VARIABLES; + } + return getDefault().getDescriptor().getUniqueIdentifier(); + } +} |