Community
Participate
Working Groups
In reaction to bug 352992 I request to change the javadoc of Display.getDefault() to something like: /** * Returns the default display. One is created (making the thread that * invokes this method its user-interface thread) if it did not already * exist. * <p/> * Calling this method should be avoided. Instead, get the display from the * parent widget by calling {@link Widget#getDisplay()}. Inside the Eclipse * Workbench the method <code>IWorkbench.getDisplay()</code> must be called * instead of this method. * * @return the default display */
why should Display.getDefault() be avoid ?
(In reply to comment #1) > why should Display.getDefault() be avoid ? Because it is not guaranteed to return the Display that runs the user interface.
(In reply to comment #2) > (In reply to comment #1) > > why should Display.getDefault() be avoid ? > > Because it is not guaranteed to return the Display that runs the user > interface. Well.. What I wanted to point out that in case of Eclipse, the Workbench.getdisplay() method is the only save way to get the Display. I know SWT can be run sep from Eclipse but in most cases it is not.
As a consumer of SWT, the workbench has to set the policy for using or not use the display. I feel that it's a workbench problem, not really SWT (unless they want to post an see also) PW
(In reply to comment #4) > As a consumer of SWT, the workbench has to set the policy for using or not use > the display. > > I feel that it's a workbench problem, not really SWT (unless they want to post > an see also) > > PW Yes, I agree. SWT is not responsible for Workbench problems. However, since the two are so closely related. Maybe I am making a too big deal out of this. It would be nice for SWT users to know that getting the display through the parent instead of through getDefault would make sure that the correct display is used inside and outside Eclipse. It would also be nice for SWT users to know that IWorkbench.getdisplay() is the only valid way of getting the Workbench Display. Maybe I should just write a blog about it so that people can find some comments to this odd behavior in the rare case they should encounter it.
We have a reference here and nobody seems alarmed enough to fix it so I'm closing as WONTFIX