blob: 62360d1bf45bc22a3455719b119f2de928b263ba [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Kentarou FUKUDA - initial API and implementation
*******************************************************************************/
package org.eclipse.actf.examples.htmlchecker;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.actf.ui.util.AbstractUIPluginACTF;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPluginACTF {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.actf.examples.htmlchecker"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
private ResourceBundle _resourceBundle;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
public ResourceBundle getResourceBundle() {
if (null == _resourceBundle) {
Bundle bundle = getBundle();
if (null != bundle) {
_resourceBundle = Platform.getResourceBundle(bundle);
}
}
return _resourceBundle;
}
public static String getResourceString(String key) {
ResourceBundle bundle = Activator.getDefault().getResourceBundle();
try {
return (null != bundle) ? bundle.getString(key) : key;
} catch (MissingResourceException mre) {
return ""; //$NON-NLS-1$
}
}
}