1 11 package org.eclipse.ui.internal.intro.universal; 12 13 import org.eclipse.jface.resource.ImageRegistry; 14 import org.eclipse.ui.PlatformUI; 15 import org.eclipse.ui.internal.intro.universal.util.Log; 16 import org.eclipse.ui.intro.IIntroPart; 17 import org.eclipse.ui.plugin.AbstractUIPlugin; 18 import org.osgi.framework.BundleContext; 19 20 23 public class UniversalIntroPlugin extends AbstractUIPlugin { 24 public static final String PLUGIN_ID = "org.eclipse.ui.intro.universal"; 26 private static UniversalIntroPlugin inst; 28 29 private long uiCreationStartTime; 32 33 private ImageRegistry volatileImageRegistry; 37 38 41 public UniversalIntroPlugin() { 42 super(); 43 } 44 45 48 public static UniversalIntroPlugin getDefault() { 49 return inst; 50 } 51 52 55 public static IIntroPart getIntro() { 56 IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager() 57 .getIntro(); 58 return introPart; 59 } 60 61 64 public static IIntroPart showIntro(boolean standby) { 65 IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager() 66 .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), 67 standby); 68 return introPart; 69 } 70 71 75 public static boolean isIntroStandby() { 76 return PlatformUI.getWorkbench().getIntroManager().isIntroStandby( 77 getIntro()); 78 } 79 80 84 public static void setIntroStandby(boolean standby) { 85 PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(), 86 standby); 87 } 88 89 90 94 public static boolean closeIntro() { 95 return PlatformUI.getWorkbench().getIntroManager().closeIntro( 97 getIntro()); 98 } 99 100 public ImageRegistry getVolatileImageRegistry() { 101 if (volatileImageRegistry==null) { 102 volatileImageRegistry = createImageRegistry(); 103 initializeImageRegistry(volatileImageRegistry); 104 } 105 return volatileImageRegistry; 106 } 107 108 public void resetVolatileImageRegistry() { 109 if (volatileImageRegistry!=null) { 110 volatileImageRegistry.dispose(); 111 volatileImageRegistry = null; 112 } 113 } 114 115 116 121 public void start(BundleContext context) throws Exception { 122 super.start(context); 123 inst = this; 124 if (Log.logInfo) 125 Log.info("IntroPlugin - calling start on Intro bundle"); 127 } 128 129 134 public void stop(BundleContext context) throws Exception { 135 resetVolatileImageRegistry(); 136 super.stop(context); 137 } 138 139 public long gettUICreationStartTime() { 140 return uiCreationStartTime; 141 } 142 143 public void setUICreationStartTime(long uiCreationStartTime) { 144 this.uiCreationStartTime = uiCreationStartTime; 145 } 146 147 148 } 149 | Popular Tags |