1 11 package org.eclipse.ui; 12 13 import org.eclipse.jface.preference.IPreferenceStore; 14 import org.eclipse.swt.widgets.Display; 15 import org.eclipse.ui.application.WorkbenchAdvisor; 16 import org.eclipse.ui.internal.Workbench; 17 import org.eclipse.ui.internal.WorkbenchMessages; 18 import org.eclipse.ui.internal.util.PrefUtil; 19 import org.eclipse.ui.testing.TestableObject; 20 21 35 public final class PlatformUI { 36 39 public static final String PLUGIN_ID = "org.eclipse.ui"; 41 47 public static final int RETURN_OK = 0; 48 49 57 public static final int RETURN_RESTART = 1; 58 59 66 public static final int RETURN_UNSTARTABLE = 2; 67 68 75 public static final int RETURN_EMERGENCY_CLOSE = 3; 76 77 80 private PlatformUI() { 81 } 83 84 89 public static IWorkbench getWorkbench() { 90 if (Workbench.getInstance() == null) { 91 throw new IllegalStateException (WorkbenchMessages.PlatformUI_NoWorkbench); 93 } 94 return Workbench.getInstance(); 95 } 96 97 112 public static boolean isWorkbenchRunning() { 113 return Workbench.getInstance() != null 114 && Workbench.getInstance().isRunning(); 115 } 116 117 147 public static int createAndRunWorkbench(Display display, 148 WorkbenchAdvisor advisor) { 149 return Workbench.createAndRunWorkbench(display, advisor); 150 } 151 152 160 public static Display createDisplay() { 161 return Workbench.createDisplay(); 162 } 163 164 174 public static TestableObject getTestableObject() { 175 return Workbench.getWorkbenchTestable(); 176 } 177 178 186 public static IPreferenceStore getPreferenceStore() { 187 return PrefUtil.getAPIPreferenceStore(); 188 } 189 } 190 | Popular Tags |