]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/util/UserMenu.java
1 package org
.argeo
.cms
.ui
.util
;
5 import org
.argeo
.cms
.CmsException
;
6 import org
.argeo
.cms
.ui
.widgets
.auth
.CmsLoginShell
;
7 import org
.eclipse
.swt
.SWT
;
8 import org
.eclipse
.swt
.events
.ShellAdapter
;
9 import org
.eclipse
.swt
.events
.ShellEvent
;
10 import org
.eclipse
.swt
.widgets
.Control
;
11 import org
.eclipse
.swt
.widgets
.Display
;
12 import org
.eclipse
.swt
.widgets
.Shell
;
14 /** The site-related user menu */
15 public class UserMenu
extends CmsLoginShell
{
16 private final Control source
;
17 private final Node context
;
19 public UserMenu(Control source
, Node context
) {
20 super(CmsUiUtils
.getCmsView());
21 this.context
= context
;
24 throw new CmsException("Source control cannot be null.");
30 protected Shell
createShell() {
31 return new Shell(Display
.getCurrent(), SWT
.NO_TRIM
| SWT
.BORDER
| SWT
.ON_TOP
);
36 Shell shell
= getShell();
39 shell
.setLocation(source
.toDisplay(source
.getSize().x
- shell
.getSize().x
, source
.getSize().y
));
40 shell
.addShellListener(new ShellAdapter() {
41 private static final long serialVersionUID
= 5178980294808435833L;
44 public void shellDeactivated(ShellEvent e
) {
51 protected Node
getContext() {