Activator.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ///////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) 2016 Intel Corporation. //
  3. // //
  4. // All rights reserved. This program and the accompanying materials //
  5. // are made available under the terms of the Eclipse Public License v1.0 //
  6. // which accompanies this distribution, and is available at //
  7. // http://www.eclipse.org/legal/epl-v10.html //
  8. // //
  9. // Contributors: //
  10. // Intel Corporation - initial implementation and documentation //
  11. ///////////////////////////////////////////////////////////////////////////
  12. package com.intel.sgx.userguide;
  13. import org.eclipse.jface.resource.ImageDescriptor;
  14. import org.eclipse.ui.plugin.AbstractUIPlugin;
  15. import org.osgi.framework.BundleContext;
  16. /**
  17. * The activator class controls the plug-in life cycle
  18. */
  19. public class Activator extends AbstractUIPlugin {
  20. // The plug-in ID
  21. public static final String PLUGIN_ID = "com.intel.sgx.userguide"; //$NON-NLS-1$
  22. // The shared instance
  23. private static Activator plugin;
  24. /**
  25. * The constructor
  26. */
  27. public Activator() {
  28. }
  29. /*
  30. * (non-Javadoc)
  31. * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
  32. */
  33. public void start(BundleContext context) throws Exception {
  34. super.start(context);
  35. plugin = this;
  36. }
  37. /*
  38. * (non-Javadoc)
  39. * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
  40. */
  41. public void stop(BundleContext context) throws Exception {
  42. plugin = null;
  43. super.stop(context);
  44. }
  45. /**
  46. * Returns the shared instance
  47. *
  48. * @return the shared instance
  49. */
  50. public static Activator getDefault() {
  51. return plugin;
  52. }
  53. /**
  54. * Returns an image descriptor for the image file at the given
  55. * plug-in relative path
  56. *
  57. * @param path the path
  58. * @return the image descriptor
  59. */
  60. public static ImageDescriptor getImageDescriptor(String path) {
  61. return imageDescriptorFromPlugin(PLUGIN_ID, path);
  62. }
  63. }