I18n of login and data source view
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / LoginDialog.java
index eaa7ae53c079ff48517a30a108048d208c1471dd..324befb64f65085338f965225c058e76f48db585 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -20,8 +20,9 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 
+import eu.etaxonomy.taxeditor.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
  * TODO wrap in a LoginModule
@@ -32,40 +33,32 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @version 1.0
  */
 public class LoginDialog extends Dialog {
-       
+
        private static Text text_password;
        private static Text text_username;
 
-       private String title;
+       private final String title;
 
-       /**
-        * <p>Constructor for LoginDialog.</p>
-        *
-        * @param parentShell a {@link org.eclipse.swt.widgets.Shell} object.
-        */
        public LoginDialog(Shell parentShell) {
                super(parentShell);
-               title = "Login";
+               title = Messages.LoginDialog_LOGIN;
        }
-               
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-        */
+
        /** {@inheritDoc} */
        @Override
        protected Control createDialogArea(Composite parent) {
                Composite composite = (Composite) super.createDialogArea(parent);
                //add controls to composite as necessary
-               
+
 
                // Label for the heading
                final CLabel titleLabel = new CLabel(composite, SWT.NONE);
-               titleLabel.setText("User Login");
+               titleLabel.setText(Messages.LoginDialog_USER_LOGIN);
 
                // Label for the username
                final CLabel userNameLabel = new CLabel(composite, SWT.NONE);
-               userNameLabel.setText("Username");
+               userNameLabel.setText(Messages.LoginDialog_USER_NAME);
 
                // Textfield for the username
                text_username = new Text(composite, SWT.BORDER);
@@ -73,22 +66,18 @@ public class LoginDialog extends Dialog {
 
                // Label for the password
                final CLabel passwordLabel = new CLabel(composite, SWT.NONE);
-               passwordLabel.setText("Password");
+               passwordLabel.setText(Messages.LoginDialog_PASSWORD);
 
                // Textfield for the password
                text_password = new Text(composite, SWT.PASSWORD | SWT.BORDER);
                text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               
-               
+
+
                return composite;
        }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
-     */
     /** {@inheritDoc} */
+    @Override
     protected void configureShell(Shell shell) {
         super.configureShell(shell);
         if (title != null) {
@@ -96,33 +85,30 @@ public class LoginDialog extends Dialog {
                }
     }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-        */
        /** {@inheritDoc} */
        @Override
        protected void okPressed() {
                String username = text_username.getText();
                String password = text_password.getText();
-               
+
                boolean result = CdmStore.getLoginManager().authenticate(username, password);
-               
+
                if(result){
                        super.okPressed();
                }
-               
-       }       
-       
+
+       }
+
        @Override
-       protected void cancelPressed() {                
+       protected void cancelPressed() {
                if(CdmStore.getLoginManager().getAuthenticatedUser() != null){
                        super.cancelPressed();
                }else{
                        // if there is no active user and the current user chooses to cancel, we close the connection
-                       boolean result = MessageDialog.openConfirm(getShell(), "Do you really want to cancel", "Aborting the login procedure will close the database.");
-                       
+                       boolean result = MessageDialog.openConfirm(getShell(), Messages.LoginDialog_REALLY_CANCEL, Messages.LoginDialog_CANCEL_MESSAGE);
+
                        if(result){
-                               CdmStore.close(StoreUtil.getMonitor());
+                               CdmStore.close(AbstractUtility.getMonitor());
                                super.cancelPressed();
                        }
                }