RWT.getLocale() in Threads [message #642414] |
Wed, 01 December 2010 04:09  |
Eclipse User |
|
|
|
Hi,
I'm a little bit confused about the best way getting the client locale.
In most cases RWT.getLocale() returns the correct value, but in threads this doesn't work.
I have to implement a Runnable but (in my case) I can't be sure if it is executed with fork=true or fork=false.
So sometimes the messages I set in the ProgressMonitor are based on the wrong locale.
Is there a better way to get the client locale?
On my system the following snippet generates this output:
public class MyEntryPoint implements IEntryPoint {
public int createUI() {
Display display = new Display();
Shell shell = new Shell(display, SWT.TITLE);
System.out.println(RWT.getLocale().toString());
try {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
System.out.println(RWT.getLocale().toString());
}
};
ModalContext.run(runnable, true, new NullProgressMonitor(), shell.getDisplay());
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return 0;
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03509 seconds