Package xvrengine

Source Code of xvrengine.XVRPlugin

package xvrengine;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
* The activator class controls the plug-in life cycle
*/
public class XVRPlugin extends AbstractUIPlugin {

  // The plug-in ID
  public static final String PLUGIN_ID = "org.xvr.xvrengine";

  //images stored in the imageregistry of the plugin
  public static final String IMAGE_MINE_KEY = "mine";
  public static final String IMAGE_MINE_PATH = "/icons/ScriptEditor.ico";
  public static final String IMAGE_PROJECT_FOLDER_KEY = "prj-folder";
  public static final String IMAGE_PROJECT_FOLDER_PATH  = "/icons/16x16/project-folder.ico";
  public static final String IMAGE_HTML_KEY = "html";
  public static final String IMAGE_HTML_PATH = "/icons/16x16/html.ico";
 
  //default plugin preference keys
  //public static final String PREFERENCES_ACTIVE_PRJ = "active_prj";
 
  // The shared instance
  private static XVRPlugin plugin;
 
  //private ResourceManager res;
 
  public static String getPluginID(){
    return PLUGIN_ID;
  }
 
  /**
   * The constructor
   */
  public XVRPlugin() {
    //this.res = new LocalResourceManager(null);
  }

  /*
   * (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 XVRPlugin getDefault() {
    return plugin;
   
  }

  /**
   * Returns an image descriptor for the image file at the given
   * plug-in relative path
   *
   * @param path the path
   * @return the image descriptor
   */
  public static ImageDescriptor getImageDescriptor(String path) {
    return imageDescriptorFromPlugin(PLUGIN_ID, path);
  }
 
  @Override
  protected ImageRegistry createImageRegistry() {
    ImageRegistry reg = new ImageRegistry();
    reg.put(XVRPlugin.IMAGE_MINE_KEY, XVRPlugin.getImageDescriptor(XVRPlugin.IMAGE_MINE_PATH));
    reg.put(XVRPlugin.IMAGE_PROJECT_FOLDER_KEY, XVRPlugin.getImageDescriptor(XVRPlugin.IMAGE_PROJECT_FOLDER_PATH));
    reg.put(XVRPlugin.IMAGE_HTML_KEY, XVRPlugin.getImageDescriptor(XVRPlugin.IMAGE_HTML_PATH));
    return reg;
  }
}
TOP

Related Classes of xvrengine.XVRPlugin

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.