1 11 package org.eclipse.pde.internal.runtime; 12 13 import org.eclipse.swt.widgets.Shell; 14 import org.eclipse.ui.IWorkbenchPage; 15 import org.eclipse.ui.IWorkbenchWindow; 16 import org.eclipse.ui.plugin.AbstractUIPlugin; 17 import org.osgi.framework.BundleContext; 18 19 20 public class PDERuntimePlugin extends AbstractUIPlugin { 21 22 private static PDERuntimePlugin inst; 23 24 private BundleContext fContext; 25 26 public static IWorkbenchPage getActivePage() { 27 return getDefault().internalGetActivePage(); 28 } 29 30 public static Shell getActiveWorkbenchShell() { 31 return getActiveWorkbenchWindow().getShell(); 32 } 33 34 public static IWorkbenchWindow getActiveWorkbenchWindow() { 35 return getDefault().getWorkbench().getActiveWorkbenchWindow(); 36 } 37 38 public static PDERuntimePlugin getDefault() { 39 return inst; 40 } 41 42 public static String getPluginId() { 43 return getDefault().getBundle().getSymbolicName(); 44 } 45 46 public PDERuntimePlugin() { 47 inst = this; 48 } 49 50 private IWorkbenchPage internalGetActivePage() { 51 return getWorkbench().getActiveWorkbenchWindow().getActivePage(); 52 } 53 56 public void start(BundleContext context) throws Exception { 57 super.start(context); 58 this.fContext = context; 59 } 60 61 public BundleContext getBundleContext() { 62 return this.fContext; 63 } 64 65 68 public void stop(BundleContext context) throws Exception { 69 super.stop(context); 70 inst = null; 71 } 72 73 } 74 | Popular Tags |