Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 94269 Details for
Bug 109290
[WorkbenchLauncher] splash screen blocks the switch workspace dialog and creates illusion of hung application
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
A better patch.
chooser_patch.txt (text/plain), 13.95 KB, created by
Kim Horne
on 2008-03-31 14:03:58 EDT
(
hide
)
Description:
A better patch.
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2008-03-31 14:03:58 EDT
Size:
13.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java,v >retrieving revision 1.33 >diff -u -r1.33 ChooseWorkspaceDialog.java >--- src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java 24 Mar 2008 19:13:35 -0000 1.33 >+++ src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java 31 Mar 2008 16:51:33 -0000 >@@ -124,14 +124,7 @@ > * @return the dialog area control > */ > protected Control createDialogArea(Composite parent) { >- String productName = null; >- IProduct product = Platform.getProduct(); >- if (product != null) { >- productName = product.getName(); >- } >- if (productName == null) { >- productName = IDEWorkbenchMessages.ChooseWorkspaceDialog_defaultProductName; >- } >+ String productName = getWindowTitle(); > > Composite composite = (Composite) super.createDialogArea(parent); > setTitle(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogTitle); >@@ -169,17 +162,34 @@ > return composite; > } > >+ /** >+ * Returns the title that the dialog (or splash) should have. >+ * >+ * @return the window title >+ * @since 3.4 >+ */ >+ public static String getWindowTitle() { >+ String productName = null; >+ IProduct product = Platform.getProduct(); >+ if (product != null) { >+ productName = product.getName(); >+ } >+ if (productName == null) { >+ productName = IDEWorkbenchMessages.ChooseWorkspaceDialog_defaultProductName; >+ } >+ return productName; >+ } >+ > /** >- * Configures the given shell in preparation for opening this window >- * in it. >- * <p> >- * The default implementation of this framework method >- * sets the shell's image and gives it a grid layout. >- * Subclasses may extend or reimplement. >- * </p> >- * >- * @param shell the shell >- */ >+ * Configures the given shell in preparation for opening this window in it. >+ * <p> >+ * The default implementation of this framework method sets the shell's >+ * image and gives it a grid layout. Subclasses may extend or reimplement. >+ * </p> >+ * >+ * @param shell >+ * the shell >+ */ > protected void configureShell(Shell shell) { > super.configureShell(shell); > shell.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogName); >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java,v >retrieving revision 1.149 >diff -u -r1.149 WorkbenchPlugin.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java 24 Mar 2008 19:21:57 -0000 1.149 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java 31 Mar 2008 16:51:34 -0000 >@@ -12,7 +12,11 @@ > package org.eclipse.ui.internal; > > import java.io.OutputStream; >-import java.util.*; >+import java.lang.reflect.InvocationTargetException; >+import java.lang.reflect.Method; >+import java.util.Collection; >+import java.util.HashSet; >+import java.util.Locale; > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; >@@ -28,6 +32,8 @@ > import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IEditorRegistry; > import org.eclipse.ui.IElementFactory; > import org.eclipse.ui.IPerspectiveRegistry; >@@ -63,7 +69,14 @@ > import org.eclipse.ui.presentations.AbstractPresentationFactory; > import org.eclipse.ui.views.IViewRegistry; > import org.eclipse.ui.wizards.IWizardRegistry; >-import org.osgi.framework.*; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.BundleContext; >+import org.osgi.framework.BundleEvent; >+import org.osgi.framework.BundleException; >+import org.osgi.framework.BundleListener; >+import org.osgi.framework.InvalidSyntaxException; >+import org.osgi.framework.ServiceReference; >+import org.osgi.framework.SynchronousBundleListener; > > import com.ibm.icu.text.MessageFormat; > >@@ -88,6 +101,18 @@ > */ > public class WorkbenchPlugin extends AbstractUIPlugin { > >+ /** >+ * Splash shell constant. >+ */ >+ private static final String DATA_SPLASH_SHELL = "org.eclipse.ui.workbench.splashShell"; //$NON-NLS-1$ >+ >+ /** >+ * The OSGi splash property. >+ * >+ * @sicne 3.4 >+ */ >+ private static final String PROP_SPLASH_HANDLE = "org.eclipse.equinox.launcher.splash.handle"; //$NON-NLS-1$ >+ > private static final String LEFT_TO_RIGHT = "ltr"; //$NON-NLS-1$ > private static final String RIGHT_TO_LEFT = "rtl";//$NON-NLS-1$ > private static final String ORIENTATION_COMMAND_LINE = "-dir";//$NON-NLS-1$ >@@ -158,8 +183,7 @@ > > private WorkbenchOperationSupport operationSupport; > private BundleListener bundleListener; >- >- >+ > /** > * Create an instance of the WorkbenchPlugin. The workbench plugin is > * effectively the "application" for the workbench UI. The entire UI >@@ -870,7 +894,7 @@ > // Attempt to load the activator of the ui bundle. This will force lazy start > // of the ui bundle. Using the bundle activator class here because it is a > // class that needs to be loaded anyway so it should not cause extra classes >- // to be loaded. >+ // to be loaded.s > if(uiBundle != null) > uiBundle.start(Bundle.START_TRANSIENT); > } catch (BundleException e) { >@@ -1209,5 +1233,88 @@ > return startingBundles.contains(bundle); > } > } >+ >+ /** >+ * Return whether or not the OSGi framework has specified the handle of a splash shell. >+ * >+ * @return whether or not the OSGi framework has specified the handle of a splash shell >+ * @since 3.4 >+ */ >+ public static boolean isSplashHandleSpecified() { >+ return System.getProperty(PROP_SPLASH_HANDLE) != null; >+ } > >+ /** >+ * Get the splash shell for this workbench instance, if any. This will find >+ * the splash created by the launcher (native) code and wrap it in a SWT >+ * shell. This may have the side effect of setting data on the provided >+ * {@link Display}. >+ * >+ * @param display >+ * the display to parent the shell on >+ * >+ * @return the splash shell or <code>null</code> >+ * @throws InvocationTargetException >+ * @throws IllegalAccessException >+ * @throws IllegalArgumentException >+ * @throws NumberFormatException >+ * @see Display#setData(String, Object) >+ * @since 3.4 >+ */ >+ public static Shell getSplashShell(Display display) >+ throws NumberFormatException, IllegalArgumentException, >+ IllegalAccessException, InvocationTargetException { >+ Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL); >+ if (splashShell != null) >+ return splashShell; >+ >+ String splashHandle = System.getProperty(PROP_SPLASH_HANDLE); >+ if (splashHandle == null) { >+ return null; >+ } >+ >+ // look for the 32 bit internal_new shell method >+ try { >+ Method method = Shell.class.getMethod( >+ "internal_new", new Class[] { Display.class, int.class }); //$NON-NLS-1$ >+ // we're on a 32 bit platform so invoke it with splash >+ // handle as an int >+ splashShell = (Shell) method.invoke(null, new Object[] { display, >+ new Integer(splashHandle) }); >+ } catch (NoSuchMethodException e) { >+ // look for the 64 bit internal_new shell method >+ try { >+ Method method = Shell.class >+ .getMethod( >+ "internal_new", new Class[] { Display.class, long.class }); //$NON-NLS-1$ >+ >+ // we're on a 64 bit platform so invoke it with a long >+ splashShell = (Shell) method.invoke(null, new Object[] { >+ display, new Long(splashHandle) }); >+ } catch (NoSuchMethodException e2) { >+ // cant find either method - don't do anything. >+ } >+ } >+ >+ display.setData(DATA_SPLASH_SHELL, splashShell); >+ return splashShell; >+ } >+ >+ /** >+ * Removes any splash shell data set on the provided display and disposes >+ * the shell if necessary. >+ * >+ * @param display >+ * the display to parent the shell on >+ * @since 3.4 >+ */ >+ public static void unsetSplashShell(Display display) { >+ Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL); >+ if (splashShell != null) { >+ if (!splashShell.isDisposed()) >+ splashShell.dispose(); >+ display.setData(DATA_SPLASH_SHELL, null); >+ } >+ >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/Workbench.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java,v >retrieving revision 1.458 >diff -u -r1.458 Workbench.java >--- Eclipse UI/org/eclipse/ui/internal/Workbench.java 25 Mar 2008 01:38:44 -0000 1.458 >+++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 31 Mar 2008 16:51:34 -0000 >@@ -22,7 +22,6 @@ > import java.io.InputStream; > import java.io.InputStreamReader; > import java.io.OutputStreamWriter; >-import java.lang.reflect.Method; > import java.util.ArrayList; > import java.util.Arrays; > import java.util.Dictionary; >@@ -537,8 +536,7 @@ > SafeRunnable run = new SafeRunnable() { > > public void run() throws Exception { >- String splashHandle = System.getProperty("org.eclipse.equinox.launcher.splash.handle"); //$NON-NLS-1$ >- if (splashHandle == null) { >+ if (! WorkbenchPlugin.isSplashHandleSpecified()) { > createSplash = false; > return; > } >@@ -551,31 +549,8 @@ > } > > Shell splashShell = splash.getSplash(); >- if (splashShell == null) { >- // look for the 32 bit internal_new shell method >- try { >- Method method = Shell.class >- .getMethod( >- "internal_new", new Class[] { Display.class, int.class }); //$NON-NLS-1$ >- // we're on a 32 bit platform so invoke it with splash >- // handle as an int >- splashShell = (Shell) method.invoke(null, new Object[] { >- display, new Integer(splashHandle) }); >- } catch (NoSuchMethodException e) { >- // look for the 64 bit internal_new shell method >- try { >- Method method = Shell.class >- .getMethod( >- "internal_new", new Class[] { Display.class, long.class }); //$NON-NLS-1$ >- >- // we're on a 64 bit platform so invoke it with a long >- splashShell = (Shell) method.invoke(null, >- new Object[] { display, >- new Long(splashHandle) }); >- } catch (NoSuchMethodException e2) { >- // cant find either method - don't do anything. >- } >- } >+ if (splashShell == null) { >+ splashShell = WorkbenchPlugin.getSplashShell(display); > > if (splashShell == null) > return; >@@ -594,6 +569,7 @@ > if (background != null) > background.dispose(); > registration[0].unregister(); // unregister ourself >+ WorkbenchPlugin.unsetSplashShell(display); > } > > public void update() { >#P org.eclipse.ui.ide.application >Index: src/org/eclipse/ui/internal/ide/application/IDEApplication.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java,v >retrieving revision 1.4 >diff -u -r1.4 IDEApplication.java >--- src/org/eclipse/ui/internal/ide/application/IDEApplication.java 3 Oct 2007 13:29:34 -0000 1.4 >+++ src/org/eclipse/ui/internal/ide/application/IDEApplication.java 31 Mar 2008 16:51:35 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.equinox.app.IApplication; > import org.eclipse.equinox.app.IApplicationContext; >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.osgi.service.datalocation.Location; > import org.eclipse.osgi.util.NLS; >@@ -35,6 +36,7 @@ > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.ide.ChooseWorkspaceData; > import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; > import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; >@@ -86,17 +88,21 @@ > Display display = createDisplay(); > > try { >- Shell shell = new Shell(display, SWT.ON_TOP); > >- try { >- if (!checkInstanceLocation(shell)) { >- Platform.endSplash(); >- return EXIT_OK; >- } >- } finally { >- if (shell != null) { >- shell.dispose(); >- } >+ // look and see if there's a splash shell we can parent off of >+ Shell shell = WorkbenchPlugin.getSplashShell(display); >+ if (shell != null) { >+ // should should set the icon and message for this shell to be the >+ // same as the chooser dialog - this will be the guy that lives in >+ // the task bar and without these calls you'd have the default icon >+ // with no message. >+ shell.setText(ChooseWorkspaceDialog.getWindowTitle()); >+ shell.setImages(Dialog.getDefaultImages()); >+ } >+ >+ if (!checkInstanceLocation(shell)) { >+ Platform.endSplash(); >+ return EXIT_OK; > } > > // create the workbench with this advisor and run it until it exits >@@ -261,12 +267,11 @@ > * canceled the launch operation. > */ > private URL promptForWorkspace(Shell shell, ChooseWorkspaceData launchData, >- boolean force) { >+ boolean force) { > URL url = null; > do { >- // don't use the parent shell to make the dialog a top-level >- // shell. See bug 84881. >- new ChooseWorkspaceDialog(null, launchData, false, true).prompt(force); >+ // okay to use the shell now - this is the splash shell >+ new ChooseWorkspaceDialog(shell, launchData, false, true).prompt(force); > String instancePath = launchData.getSelection(); > if (instancePath == null) { > return null;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109290
:
94066
| 94269