]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java
Rename transtion bundle to cms.tp
[lgpl/argeo-commons.git] / org.argeo.cms.e4.rap / src / org / argeo / cms / e4 / rap / CmsLoginLifecycle.java
index 300c7566b4efcd9f348e2950f9f4160aad23d8bc..3ee8df1ef76c27a9b44a672c16354d4b3fe0cf8a 100644 (file)
@@ -10,15 +10,15 @@ import javax.security.auth.login.LoginException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.api.NodeConstants;
-import org.argeo.cms.CmsException;
+import org.argeo.api.cms.CmsImageManager;
+import org.argeo.api.cms.CmsView;
+import org.argeo.api.cms.UxContext;
 import org.argeo.cms.auth.CurrentUser;
-import org.argeo.cms.ui.CmsImageManager;
-import org.argeo.cms.ui.CmsView;
-import org.argeo.cms.ui.UxContext;
-import org.argeo.cms.ui.dialogs.CmsFeedback;
+import org.argeo.cms.swt.CmsSwtUtils;
+import org.argeo.cms.swt.SimpleSwtUxContext;
+import org.argeo.cms.swt.auth.CmsLoginShell;
+import org.argeo.cms.swt.dialogs.CmsFeedback;
 import org.argeo.cms.ui.util.SimpleImageManager;
-import org.argeo.cms.ui.util.SimpleUxContext;
-import org.argeo.cms.ui.widgets.auth.CmsLoginShell;
 import org.eclipse.e4.core.services.events.IEventBroker;
 import org.eclipse.e4.ui.workbench.UIEvents;
 import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
@@ -64,7 +64,7 @@ public class CmsLoginLifecycle implements CmsView {
                Display display = Display.getCurrent();
 //             UiContext.setData(CmsView.KEY, this);
                CmsLoginShell loginShell = new CmsLoginShell(this);
-               CmsView.registerCmsView(loginShell.getShell(), this);
+               CmsSwtUtils.registerCmsView(loginShell.getShell(), this);
                loginShell.setSubject(subject);
                try {
                        // try pre-auth
@@ -81,7 +81,7 @@ public class CmsLoginLifecycle implements CmsView {
                }
                if (CurrentUser.getUsername(getSubject()) == null)
                        return false;
-               uxContext = new SimpleUxContext();
+               uxContext = new SimpleSwtUxContext();
                imageManager = new SimpleImageManager();
 
                eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
@@ -114,7 +114,7 @@ public class CmsLoginLifecycle implements CmsView {
        @Override
        public void authChange(LoginContext loginContext) {
                if (loginContext == null)
-                       throw new CmsException("Login context cannot be null");
+                       throw new IllegalArgumentException("Login context cannot be null");
                // logout previous login context
                // if (this.loginContext != null)
                // try {
@@ -128,12 +128,12 @@ public class CmsLoginLifecycle implements CmsView {
        @Override
        public void logout() {
                if (loginContext == null)
-                       throw new CmsException("Login context should not be null");
+                       throw new IllegalStateException("Login context should not be null");
                try {
                        CurrentUser.logoutCmsSession(loginContext.getSubject());
                        loginContext.logout();
                } catch (LoginException e) {
-                       throw new CmsException("Cannot log out", e);
+                       throw new IllegalStateException("Cannot log out", e);
                }
        }