Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 109290 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java (-18 / +28 lines)
Lines 124-137 Link Here
124
     * @return the dialog area control
124
     * @return the dialog area control
125
     */
125
     */
126
    protected Control createDialogArea(Composite parent) {
126
    protected Control createDialogArea(Composite parent) {
127
        String productName = null;
127
        String productName = getWindowTitle();
128
        IProduct product = Platform.getProduct();
129
        if (product != null) {
130
            productName = product.getName();
131
        }
132
        if (productName == null) {
133
            productName = IDEWorkbenchMessages.ChooseWorkspaceDialog_defaultProductName;
134
        }
135
128
136
        Composite composite = (Composite) super.createDialogArea(parent);
129
        Composite composite = (Composite) super.createDialogArea(parent);
137
        setTitle(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogTitle);
130
        setTitle(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogTitle);
Lines 169-185 Link Here
169
        return composite;
162
        return composite;
170
    }
163
    }
171
164
165
	/**
166
	 * Returns the title that the dialog (or splash) should have.
167
	 * 
168
	 * @return the window title
169
	 * @since 3.4
170
	 */
171
	public static String getWindowTitle() {
172
		String productName = null;
173
		IProduct product = Platform.getProduct();
174
		if (product != null) {
175
			productName = product.getName();
176
		}
177
		if (productName == null) {
178
			productName = IDEWorkbenchMessages.ChooseWorkspaceDialog_defaultProductName;
179
		}
180
		return productName;
181
	}
182
172
    /**
183
    /**
173
     * Configures the given shell in preparation for opening this window
184
	 * Configures the given shell in preparation for opening this window in it.
174
     * in it.
185
	 * <p>
175
     * <p>
186
	 * The default implementation of this framework method sets the shell's
176
     * The default implementation of this framework method
187
	 * image and gives it a grid layout. Subclasses may extend or reimplement.
177
     * sets the shell's image and gives it a grid layout. 
188
	 * </p>
178
     * Subclasses may extend or reimplement.
189
	 * 
179
     * </p>
190
	 * @param shell
180
     * 
191
	 *            the shell
181
     * @param shell the shell
192
	 */
182
     */
183
    protected void configureShell(Shell shell) {
193
    protected void configureShell(Shell shell) {
184
        super.configureShell(shell);
194
        super.configureShell(shell);
185
        shell.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogName);
195
        shell.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogName);
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java (-5 / +112 lines)
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
}
(-)Eclipse UI/org/eclipse/ui/internal/Workbench.java (-28 / +4 lines)
Lines 22-28 Link Here
22
import java.io.InputStream;
22
import java.io.InputStream;
23
import java.io.InputStreamReader;
23
import java.io.InputStreamReader;
24
import java.io.OutputStreamWriter;
24
import java.io.OutputStreamWriter;
25
import java.lang.reflect.Method;
26
import java.util.ArrayList;
25
import java.util.ArrayList;
27
import java.util.Arrays;
26
import java.util.Arrays;
28
import java.util.Dictionary;
27
import java.util.Dictionary;
Lines 537-544 Link Here
537
		SafeRunnable run = new SafeRunnable() {
536
		SafeRunnable run = new SafeRunnable() {
538
537
539
			public void run() throws Exception {
538
			public void run() throws Exception {
540
				String splashHandle = System.getProperty("org.eclipse.equinox.launcher.splash.handle"); //$NON-NLS-1$
539
				if (! WorkbenchPlugin.isSplashHandleSpecified()) {
541
				if (splashHandle == null) {
542
					createSplash = false;
540
					createSplash = false;
543
					return;
541
					return;
544
				}
542
				}
Lines 551-581 Link Here
551
				}
549
				}
552
				
550
				
553
				Shell splashShell = splash.getSplash();
551
				Shell splashShell = splash.getSplash();
554
				if (splashShell == null) {
552
				if (splashShell == null) {					
555
					// look for the 32 bit internal_new shell method
553
					splashShell = WorkbenchPlugin.getSplashShell(display);
556
					try {
557
						Method method = Shell.class
558
								.getMethod(
559
										"internal_new", new Class[] { Display.class, int.class }); //$NON-NLS-1$
560
						// we're on a 32 bit platform so invoke it with splash
561
						// handle as an int
562
						splashShell = (Shell) method.invoke(null, new Object[] {
563
								display, new Integer(splashHandle) });
564
					} catch (NoSuchMethodException e) {
565
						// look for the 64 bit internal_new shell method
566
						try {
567
							Method method = Shell.class
568
									.getMethod(
569
											"internal_new", new Class[] { Display.class, long.class }); //$NON-NLS-1$
570
571
							// we're on a 64 bit platform so invoke it with a long
572
							splashShell = (Shell) method.invoke(null,
573
									new Object[] { display,
574
											new Long(splashHandle) });
575
						} catch (NoSuchMethodException e2) {
576
							// cant find either method - don't do anything.
577
						}
578
					}
579
					
554
					
580
					if (splashShell == null)
555
					if (splashShell == null)
581
						return;
556
						return;
Lines 594-599 Link Here
594
						if (background != null)
569
						if (background != null)
595
							background.dispose();
570
							background.dispose();
596
						registration[0].unregister(); // unregister ourself
571
						registration[0].unregister(); // unregister ourself
572
						WorkbenchPlugin.unsetSplashShell(display);
597
					}
573
					}
598
574
599
					public void update() {
575
					public void update() {
(-)src/org/eclipse/ui/internal/ide/application/IDEApplication.java (-14 / +19 lines)
Lines 26-31 Link Here
26
import org.eclipse.core.runtime.Status;
26
import org.eclipse.core.runtime.Status;
27
import org.eclipse.equinox.app.IApplication;
27
import org.eclipse.equinox.app.IApplication;
28
import org.eclipse.equinox.app.IApplicationContext;
28
import org.eclipse.equinox.app.IApplicationContext;
29
import org.eclipse.jface.dialogs.Dialog;
29
import org.eclipse.jface.dialogs.MessageDialog;
30
import org.eclipse.jface.dialogs.MessageDialog;
30
import org.eclipse.osgi.service.datalocation.Location;
31
import org.eclipse.osgi.service.datalocation.Location;
31
import org.eclipse.osgi.util.NLS;
32
import org.eclipse.osgi.util.NLS;
Lines 35-40 Link Here
35
import org.eclipse.swt.widgets.Shell;
36
import org.eclipse.swt.widgets.Shell;
36
import org.eclipse.ui.IWorkbench;
37
import org.eclipse.ui.IWorkbench;
37
import org.eclipse.ui.PlatformUI;
38
import org.eclipse.ui.PlatformUI;
39
import org.eclipse.ui.internal.WorkbenchPlugin;
38
import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
40
import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
39
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
41
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
40
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
42
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
Lines 86-102 Link Here
86
        Display display = createDisplay();
88
        Display display = createDisplay();
87
89
88
        try {
90
        try {
89
            Shell shell = new Shell(display, SWT.ON_TOP);
90
91
91
            try {
92
        	// look and see if there's a splash shell we can parent off of
92
                if (!checkInstanceLocation(shell)) {
93
        	Shell shell = WorkbenchPlugin.getSplashShell(display);
93
                    Platform.endSplash();
94
        	if (shell != null) {
94
                    return EXIT_OK;
95
        		// should should set the icon and message for this shell to be the 
95
                }
96
        		// same as the chooser dialog - this will be the guy that lives in
96
            } finally {
97
        		// the task bar and without these calls you'd have the default icon 
97
                if (shell != null) {
98
        		// with no message.
98
					shell.dispose();
99
        		shell.setText(ChooseWorkspaceDialog.getWindowTitle());
99
				}
100
        		shell.setImages(Dialog.getDefaultImages());
101
        	}
102
           
103
            if (!checkInstanceLocation(shell)) {
104
                Platform.endSplash();
105
                return EXIT_OK;
100
            }
106
            }
101
107
102
            // create the workbench with this advisor and run it until it exits
108
            // create the workbench with this advisor and run it until it exits
Lines 261-272 Link Here
261
     *         canceled the launch operation.
267
     *         canceled the launch operation.
262
     */
268
     */
263
    private URL promptForWorkspace(Shell shell, ChooseWorkspaceData launchData,
269
    private URL promptForWorkspace(Shell shell, ChooseWorkspaceData launchData,
264
            boolean force) {
270
			boolean force) {
265
        URL url = null;
271
        URL url = null;
266
        do {
272
        do {
267
        	// don't use the parent shell to make the dialog a top-level
273
        	// okay to use the shell now - this is the splash shell
268
        	// shell. See bug 84881.
274
            new ChooseWorkspaceDialog(shell, launchData, false, true).prompt(force);
269
            new ChooseWorkspaceDialog(null, launchData, false, true).prompt(force);
270
            String instancePath = launchData.getSelection();
275
            String instancePath = launchData.getSelection();
271
            if (instancePath == null) {
276
            if (instancePath == null) {
272
				return null;
277
				return null;

Return to bug 109290