Add menu entry for password dialog to main menu #3102
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 21 Jun 2016 11:16:16 +0000 (13:16 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 21 Jun 2016 11:51:05 +0000 (13:51 +0200)
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java

index 127b91c2a0b124b067de30ce45c691c175c355ac..babc87b9d006d0a9e2290c6dc59154f6f6be365a 100644 (file)
                </reference>
             </visibleWhen>
          </command>
+         <command
+               commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
+               label="Change password"
+               style="push">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isUserLoggedIn">
+               </reference>
+            </visibleWhen>
+         </command>
          <command
                commandId="eu.etaxonomy.taxeditor.store.operations.reconnect"
                label="%command.label.RE_CONNECT"
index f7db817d39ac79e1599b279fe5afb21f0131a2f2..9b000fcb436c94831fd43abf9e5a6f0bcb0c2834 100644 (file)
@@ -43,6 +43,7 @@ public class PasswordWizard extends Wizard implements IConversationEnabled{
        public PasswordWizard(User user, ConversationHolder conversation){
                this.conversation = conversation;
                this.user = user;
+               setWindowTitle("Change password");
        }
 
        @Override
index cbe5a25a1736506abd2d30408712524dafbd7be1..4d1b7514862775e556fddff26f6a0653002b4179 100644 (file)
@@ -14,11 +14,11 @@ import org.eclipse.jface.dialogs.IInputValidator;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
@@ -42,14 +42,14 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage<User> implem
        private TextWithLabelElement text_passwordRepeat;
        private final PasswordValidator passwordValidator;
 
-       private final UniqueUserNameValidator uniqueUsernameValidator;
-
        protected PasswordWizardPage(CdmFormFactory formFactory,
                        ConversationHolder conversation, User entity) {
                super(formFactory, conversation, entity);
 
                passwordValidator = new PasswordValidator();
-               uniqueUsernameValidator = new UniqueUserNameValidator();
+
+               setTitle("Change password");
+               setDescription("Change password and confirm with current password");
        }
 
        @Override
@@ -70,6 +70,9 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage<User> implem
 
                ((Text)text_passwordRepeat.getMainControl()).addModifyListener(this);
 
+               Color bgColor = getShell().getBackground();
+               rootElement.setBackground(bgColor);
+               control.setBackground(bgColor);
                setControl(control);
        }
 
@@ -104,28 +107,6 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage<User> implem
                setErrorMessage(message);
        }
 
-       private class UniqueUserNameValidator implements IInputValidator{
-
-               private static final String USER_EXISTS = "Username already exists";
-               private static final String NAME_TO_SHORT = "Username is empty";
-
-               @Override
-        public String isValid(String newText) {
-                       // query for username
-                       if(newText.length() < 1){
-                               setPageComplete(false);
-                               return NAME_TO_SHORT;
-                       }
-                       if(CdmStore.getService(IUserService.class).userExists(newText)){
-                               setPageComplete(false);
-                               return USER_EXISTS;
-                       }
-
-                       setPageComplete(true);
-                       return null;
-               }
-       }
-
        private class PasswordValidator implements IInputValidator{
 
                private static final int PW_MIN_LENGTH = 5;