|
Lines 12-18
Link Here
|
| 12 |
package org.eclipse.ui.internal; |
12 |
package org.eclipse.ui.internal; |
| 13 |
|
13 |
|
| 14 |
import java.io.OutputStream; |
14 |
import java.io.OutputStream; |
| 15 |
import java.util.*; |
15 |
import java.lang.reflect.InvocationTargetException; |
|
|
16 |
import java.lang.reflect.Method; |
| 17 |
import java.util.Collection; |
| 18 |
import java.util.HashSet; |
| 19 |
import java.util.Locale; |
| 16 |
|
20 |
|
| 17 |
import org.eclipse.core.runtime.CoreException; |
21 |
import org.eclipse.core.runtime.CoreException; |
| 18 |
import org.eclipse.core.runtime.IConfigurationElement; |
22 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.jface.window.Window; |
32 |
import org.eclipse.jface.window.Window; |
| 29 |
import org.eclipse.swt.SWT; |
33 |
import org.eclipse.swt.SWT; |
| 30 |
import org.eclipse.swt.custom.BusyIndicator; |
34 |
import org.eclipse.swt.custom.BusyIndicator; |
|
|
35 |
import org.eclipse.swt.widgets.Display; |
| 36 |
import org.eclipse.swt.widgets.Shell; |
| 31 |
import org.eclipse.ui.IEditorRegistry; |
37 |
import org.eclipse.ui.IEditorRegistry; |
| 32 |
import org.eclipse.ui.IElementFactory; |
38 |
import org.eclipse.ui.IElementFactory; |
| 33 |
import org.eclipse.ui.IPerspectiveRegistry; |
39 |
import org.eclipse.ui.IPerspectiveRegistry; |
|
Lines 63-69
Link Here
|
| 63 |
import org.eclipse.ui.presentations.AbstractPresentationFactory; |
69 |
import org.eclipse.ui.presentations.AbstractPresentationFactory; |
| 64 |
import org.eclipse.ui.views.IViewRegistry; |
70 |
import org.eclipse.ui.views.IViewRegistry; |
| 65 |
import org.eclipse.ui.wizards.IWizardRegistry; |
71 |
import org.eclipse.ui.wizards.IWizardRegistry; |
| 66 |
import org.osgi.framework.*; |
72 |
import org.osgi.framework.Bundle; |
|
|
73 |
import org.osgi.framework.BundleContext; |
| 74 |
import org.osgi.framework.BundleEvent; |
| 75 |
import org.osgi.framework.BundleException; |
| 76 |
import org.osgi.framework.BundleListener; |
| 77 |
import org.osgi.framework.InvalidSyntaxException; |
| 78 |
import org.osgi.framework.ServiceReference; |
| 79 |
import org.osgi.framework.SynchronousBundleListener; |
| 67 |
|
80 |
|
| 68 |
import com.ibm.icu.text.MessageFormat; |
81 |
import com.ibm.icu.text.MessageFormat; |
| 69 |
|
82 |
|
|
Lines 88-93
Link Here
|
| 88 |
*/ |
101 |
*/ |
| 89 |
public class WorkbenchPlugin extends AbstractUIPlugin { |
102 |
public class WorkbenchPlugin extends AbstractUIPlugin { |
| 90 |
|
103 |
|
|
|
104 |
/** |
| 105 |
* Splash shell constant. |
| 106 |
*/ |
| 107 |
private static final String DATA_SPLASH_SHELL = "org.eclipse.ui.workbench.splashShell"; //$NON-NLS-1$ |
| 108 |
|
| 109 |
/** |
| 110 |
* The OSGi splash property. |
| 111 |
* |
| 112 |
* @sicne 3.4 |
| 113 |
*/ |
| 114 |
private static final String PROP_SPLASH_HANDLE = "org.eclipse.equinox.launcher.splash.handle"; //$NON-NLS-1$ |
| 115 |
|
| 91 |
private static final String LEFT_TO_RIGHT = "ltr"; //$NON-NLS-1$ |
116 |
private static final String LEFT_TO_RIGHT = "ltr"; //$NON-NLS-1$ |
| 92 |
private static final String RIGHT_TO_LEFT = "rtl";//$NON-NLS-1$ |
117 |
private static final String RIGHT_TO_LEFT = "rtl";//$NON-NLS-1$ |
| 93 |
private static final String ORIENTATION_COMMAND_LINE = "-dir";//$NON-NLS-1$ |
118 |
private static final String ORIENTATION_COMMAND_LINE = "-dir";//$NON-NLS-1$ |
|
Lines 158-165
Link Here
|
| 158 |
|
183 |
|
| 159 |
private WorkbenchOperationSupport operationSupport; |
184 |
private WorkbenchOperationSupport operationSupport; |
| 160 |
private BundleListener bundleListener; |
185 |
private BundleListener bundleListener; |
| 161 |
|
186 |
|
| 162 |
|
|
|
| 163 |
/** |
187 |
/** |
| 164 |
* Create an instance of the WorkbenchPlugin. The workbench plugin is |
188 |
* Create an instance of the WorkbenchPlugin. The workbench plugin is |
| 165 |
* effectively the "application" for the workbench UI. The entire UI |
189 |
* effectively the "application" for the workbench UI. The entire UI |
|
Lines 870-876
Link Here
|
| 870 |
// Attempt to load the activator of the ui bundle. This will force lazy start |
894 |
// Attempt to load the activator of the ui bundle. This will force lazy start |
| 871 |
// of the ui bundle. Using the bundle activator class here because it is a |
895 |
// of the ui bundle. Using the bundle activator class here because it is a |
| 872 |
// class that needs to be loaded anyway so it should not cause extra classes |
896 |
// class that needs to be loaded anyway so it should not cause extra classes |
| 873 |
// to be loaded. |
897 |
// to be loaded.s |
| 874 |
if(uiBundle != null) |
898 |
if(uiBundle != null) |
| 875 |
uiBundle.start(Bundle.START_TRANSIENT); |
899 |
uiBundle.start(Bundle.START_TRANSIENT); |
| 876 |
} catch (BundleException e) { |
900 |
} catch (BundleException e) { |
|
Lines 1209-1213
Link Here
|
| 1209 |
return startingBundles.contains(bundle); |
1233 |
return startingBundles.contains(bundle); |
| 1210 |
} |
1234 |
} |
| 1211 |
} |
1235 |
} |
|
|
1236 |
|
| 1237 |
/** |
| 1238 |
* Return whether or not the OSGi framework has specified the handle of a splash shell. |
| 1239 |
* |
| 1240 |
* @return whether or not the OSGi framework has specified the handle of a splash shell |
| 1241 |
* @since 3.4 |
| 1242 |
*/ |
| 1243 |
public static boolean isSplashHandleSpecified() { |
| 1244 |
return System.getProperty(PROP_SPLASH_HANDLE) != null; |
| 1245 |
} |
| 1212 |
|
1246 |
|
|
|
1247 |
/** |
| 1248 |
* Get the splash shell for this workbench instance, if any. This will find |
| 1249 |
* the splash created by the launcher (native) code and wrap it in a SWT |
| 1250 |
* shell. This may have the side effect of setting data on the provided |
| 1251 |
* {@link Display}. |
| 1252 |
* |
| 1253 |
* @param display |
| 1254 |
* the display to parent the shell on |
| 1255 |
* |
| 1256 |
* @return the splash shell or <code>null</code> |
| 1257 |
* @throws InvocationTargetException |
| 1258 |
* @throws IllegalAccessException |
| 1259 |
* @throws IllegalArgumentException |
| 1260 |
* @throws NumberFormatException |
| 1261 |
* @see Display#setData(String, Object) |
| 1262 |
* @since 3.4 |
| 1263 |
*/ |
| 1264 |
public static Shell getSplashShell(Display display) |
| 1265 |
throws NumberFormatException, IllegalArgumentException, |
| 1266 |
IllegalAccessException, InvocationTargetException { |
| 1267 |
Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL); |
| 1268 |
if (splashShell != null) |
| 1269 |
return splashShell; |
| 1270 |
|
| 1271 |
String splashHandle = System.getProperty(PROP_SPLASH_HANDLE); |
| 1272 |
if (splashHandle == null) { |
| 1273 |
return null; |
| 1274 |
} |
| 1275 |
|
| 1276 |
// look for the 32 bit internal_new shell method |
| 1277 |
try { |
| 1278 |
Method method = Shell.class.getMethod( |
| 1279 |
"internal_new", new Class[] { Display.class, int.class }); //$NON-NLS-1$ |
| 1280 |
// we're on a 32 bit platform so invoke it with splash |
| 1281 |
// handle as an int |
| 1282 |
splashShell = (Shell) method.invoke(null, new Object[] { display, |
| 1283 |
new Integer(splashHandle) }); |
| 1284 |
} catch (NoSuchMethodException e) { |
| 1285 |
// look for the 64 bit internal_new shell method |
| 1286 |
try { |
| 1287 |
Method method = Shell.class |
| 1288 |
.getMethod( |
| 1289 |
"internal_new", new Class[] { Display.class, long.class }); //$NON-NLS-1$ |
| 1290 |
|
| 1291 |
// we're on a 64 bit platform so invoke it with a long |
| 1292 |
splashShell = (Shell) method.invoke(null, new Object[] { |
| 1293 |
display, new Long(splashHandle) }); |
| 1294 |
} catch (NoSuchMethodException e2) { |
| 1295 |
// cant find either method - don't do anything. |
| 1296 |
} |
| 1297 |
} |
| 1298 |
|
| 1299 |
display.setData(DATA_SPLASH_SHELL, splashShell); |
| 1300 |
return splashShell; |
| 1301 |
} |
| 1302 |
|
| 1303 |
/** |
| 1304 |
* Removes any splash shell data set on the provided display and disposes |
| 1305 |
* the shell if necessary. |
| 1306 |
* |
| 1307 |
* @param display |
| 1308 |
* the display to parent the shell on |
| 1309 |
* @since 3.4 |
| 1310 |
*/ |
| 1311 |
public static void unsetSplashShell(Display display) { |
| 1312 |
Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL); |
| 1313 |
if (splashShell != null) { |
| 1314 |
if (!splashShell.isDisposed()) |
| 1315 |
splashShell.dispose(); |
| 1316 |
display.setData(DATA_SPLASH_SHELL, null); |
| 1317 |
} |
| 1318 |
|
| 1319 |
} |
| 1213 |
} |
1320 |
} |