]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - UiContext.java
20163cffa927732b598df6af4a508a8d2411430c
1 package org
.argeo
.eclipse
.ui
.specific
;
3 import java
.util
.Locale
;
5 import javax
.servlet
.http
.HttpServletRequest
;
6 import javax
.servlet
.http
.HttpServletResponse
;
8 import org
.eclipse
.swt
.widgets
.Display
;
10 /** Singleton class providing single sources infos about the UI context. */
11 public class UiContext
{
13 public static HttpServletRequest
getHttpRequest() {
17 public static HttpServletResponse
getHttpResponse() {
21 public static Locale
getLocale() {
22 return Locale
.getDefault();
25 public static void setLocale(Locale locale
) {
26 Locale
.setDefault(locale
);
29 /** Can always be null */
30 @SuppressWarnings("unchecked")
31 public static <T
> T
getData(String key
) {
32 Display display
= getDisplay();
35 return (T
) display
.getData(key
);
38 public static void setData(String key
, Object value
) {
39 Display display
= getDisplay();
41 throw new IllegalStateException("Not display available");
42 display
.setData(key
, value
);
45 private static Display
getDisplay() {
46 return Display
.getCurrent();