]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - rcp/org.argeo.eclipse.ui.rcp/src/org/argeo/eclipse/ui/specific/UiContext.java
bb7cea2e609e663e95ee00a85fab03826139ec56
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 SingleSourcingException(
42 "Not display available in RAP context");
43 display
.setData(key
, value
);
46 private static Display
getDisplay() {
47 return Display
.getCurrent();