/******************************************************************************* | |
* Copyright (c) 2008 The University of York. | |
* This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License 2.0 | |
* which is available at https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* Contributors: | |
* Dimitrios Kolovos - initial API and implementation | |
******************************************************************************/ | |
package org.eclipse.epsilon.ewl.emf; | |
import java.net.URL; | |
import org.eclipse.core.runtime.FileLocator; | |
import org.eclipse.core.runtime.Path; | |
import org.eclipse.core.runtime.Platform; | |
import org.eclipse.jface.resource.ImageDescriptor; | |
import org.eclipse.ui.plugin.AbstractUIPlugin; | |
import org.osgi.framework.Bundle; | |
import org.osgi.framework.BundleContext; | |
/** | |
* The activator class controls the plug-in life cycle | |
*/ | |
public class EwlEmfPlugin extends AbstractUIPlugin { | |
// The plug-in ID | |
public static final String PLUGIN_ID = "org.eclipse.epsilon.ewl.emf"; | |
// The shared instance | |
private static EwlEmfPlugin plugin; | |
/** | |
* The constructor | |
*/ | |
public EwlEmfPlugin() { | |
} | |
/* | |
* (non-Javadoc) | |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | |
*/ | |
@Override | |
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) | |
*/ | |
@Override | |
public void stop(BundleContext context) throws Exception { | |
plugin = null; | |
super.stop(context); | |
} | |
/** | |
* Returns the shared instance | |
* | |
* @return the shared instance | |
*/ | |
public static EwlEmfPlugin getDefault() { | |
return plugin; | |
} | |
public static ImageDescriptor getImageDescriptor(String path) { | |
return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.epsilon.ewl.emf", path); | |
} | |
public static URL getResourcePath(String path) { | |
Bundle bundle = Platform.getBundle(PLUGIN_ID); | |
return FileLocator.find(bundle, new Path(path), null); | |
} | |
} |