]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - cms/ui/util/UserMenu.java
1 package org
.argeo
.cms
.ui
.util
;
5 import org
.argeo
.cms
.swt
.CmsException
;
6 import org
.argeo
.cms
.swt
.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 // FIXME pass CMS context
21 super(CmsUiUtils
.getCmsView(), null);
22 this.context
= context
;
25 throw new CmsException("Source control cannot be null.");
31 protected Shell
createShell() {
32 return new Shell(Display
.getCurrent(), SWT
.NO_TRIM
| SWT
.BORDER
| SWT
.ON_TOP
);
37 Shell shell
= getShell();
40 shell
.setLocation(source
.toDisplay(source
.getSize().x
- shell
.getSize().x
, source
.getSize().y
));
41 shell
.addShellListener(new ShellAdapter() {
42 private static final long serialVersionUID
= 5178980294808435833L;
45 public void shellDeactivated(ShellEvent e
) {
52 protected Node
getContext() {