1 11 package org.eclipse.ui.internal.intro.impl; 12 13 import org.eclipse.jface.resource.ImageRegistry; 14 import org.eclipse.ui.PlatformUI; 15 import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot; 16 import org.eclipse.ui.internal.intro.impl.model.loader.ExtensionPointManager; 17 import org.eclipse.ui.internal.intro.impl.presentations.IntroLaunchBar; 18 import org.eclipse.ui.internal.intro.impl.util.Log; 19 import org.eclipse.ui.intro.IIntroPart; 20 import org.eclipse.ui.plugin.AbstractUIPlugin; 21 import org.osgi.framework.BundleContext; 22 23 26 public class IntroPlugin extends AbstractUIPlugin { 27 public static final String PLUGIN_ID = "org.eclipse.ui.intro"; 29 private static IntroPlugin inst; 31 32 private IntroLaunchBar launchBar; 35 36 private long uiCreationStartTime; 39 40 private ImageRegistry volatileImageRegistry; 44 45 46 47 50 public IntroPlugin() { 51 super(); 52 } 53 54 57 public static IntroPlugin getDefault() { 58 return inst; 59 } 60 61 public ImageRegistry getVolatileImageRegistry() { 62 if (volatileImageRegistry==null) { 63 volatileImageRegistry = createImageRegistry(); 64 initializeImageRegistry(volatileImageRegistry); 65 } 66 return volatileImageRegistry; 67 } 68 69 public void resetVolatileImageRegistry() { 70 if (volatileImageRegistry!=null) { 71 volatileImageRegistry.dispose(); 72 volatileImageRegistry = null; 73 } 74 } 75 76 77 public void closeLaunchBar() { 78 if (launchBar != null) { 79 launchBar.close(); 80 launchBar = null; 81 } 82 } 83 84 public void setLaunchBar(IntroLaunchBar launchBar) { 85 this.launchBar = launchBar; 86 } 87 88 89 92 public ExtensionPointManager getExtensionPointManager() { 93 return ExtensionPointManager.getInst(); 94 } 95 96 101 public IntroModelRoot getIntroModelRoot() { 102 return getExtensionPointManager().getCurrentModel(); 103 } 104 105 108 public static IIntroPart getIntro() { 109 IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager() 110 .getIntro(); 111 return introPart; 112 } 113 114 117 public static IIntroPart showIntro(boolean standby) { 118 IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager() 119 .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), 120 standby); 121 return introPart; 122 } 123 124 128 public static boolean isIntroStandby() { 129 return PlatformUI.getWorkbench().getIntroManager().isIntroStandby( 130 getIntro()); 131 } 132 133 137 public static void setIntroStandby(boolean standby) { 138 PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(), 139 standby); 140 } 141 142 143 147 public static boolean closeIntro() { 148 return PlatformUI.getWorkbench().getIntroManager().closeIntro( 150 getIntro()); 151 } 152 153 154 159 public void start(BundleContext context) throws Exception { 160 super.start(context); 161 inst = this; 162 if (Log.logInfo) 163 Log.info("IntroPlugin - calling start on Intro bundle"); 165 } 166 167 172 public void stop(BundleContext context) throws Exception { 173 resetVolatileImageRegistry(); 174 super.stop(context); 175 } 176 177 public long gettUICreationStartTime() { 178 return uiCreationStartTime; 179 } 180 181 public void setUICreationStartTime(long uiCreationStartTime) { 182 this.uiCreationStartTime = uiCreationStartTime; 183 } 184 185 186 } 187 | Popular Tags |