Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / handler / OpenPasswordWizzardHandler.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.handler;
11
12 import org.eclipse.core.commands.AbstractHandler;
13 import org.eclipse.core.commands.ExecutionEvent;
14 import org.eclipse.core.commands.ExecutionException;
15 import org.eclipse.core.commands.IHandler;
16 import org.eclipse.jface.wizard.WizardDialog;
17
18 import eu.etaxonomy.cdm.model.common.User;
19 import eu.etaxonomy.taxeditor.model.AbstractUtility;
20 import eu.etaxonomy.taxeditor.model.MessagingUtils;
21 import eu.etaxonomy.taxeditor.store.CdmStore;
22 import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
23
24 /**
25 * <p>ShowLoginWindowHandler class.</p>
26 *
27 * @author n.hoffmann
28 * @created Aug 7, 2009
29 * @version 1.0
30 */
31 public class OpenPasswordWizzardHandler extends AbstractHandler implements IHandler{
32
33 /* (non-Javadoc)
34 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
35 */
36 /** {@inheritDoc} */
37 @Override
38 public Object execute(ExecutionEvent event) throws ExecutionException {
39
40 Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
41
42 if(principal instanceof User){
43
44 PasswordWizard wizard = new PasswordWizard((User)principal, null);
45 WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
46
47 dialog.open();
48
49 } else {
50 // should never happen, log an error
51 MessagingUtils.error(OpenPasswordWizzardHandler.class, "The principal currently authenticated is not a eu.etaxonomy.cdm.model.common.User", null);
52 }
53
54 return null;
55
56 }
57
58
59
60 }