Project

General

Profile

Download (1.74 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.handler;
12

    
13
import org.eclipse.core.commands.AbstractHandler;
14
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.commands.IHandler;
17
import org.eclipse.jface.wizard.WizardDialog;
18

    
19
import eu.etaxonomy.cdm.model.common.User;
20
import eu.etaxonomy.taxeditor.model.AbstractUtility;
21
import eu.etaxonomy.taxeditor.model.MessagingUtils;
22
import eu.etaxonomy.taxeditor.store.CdmStore;
23
import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
24

    
25
/**
26
 * <p>ShowLoginWindowHandler class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created Aug 7, 2009
30
 * @version 1.0
31
 */
32
public class OpenPasswordWizzardHandler extends AbstractHandler implements IHandler{
33

    
34
	/* (non-Javadoc)
35
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
36
	 */
37
	/** {@inheritDoc} */
38
	@Override
39
    public Object execute(ExecutionEvent event) throws ExecutionException {
40

    
41
	    Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
42

    
43
	    if(principal instanceof User){
44

    
45
	        PasswordWizard wizard = new PasswordWizard((User)principal, null);
46
	        WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
47

    
48
	        dialog.open();
49

    
50
	    } else {
51
	        // should never happen, log an error
52
	        MessagingUtils.error(OpenPasswordWizzardHandler.class, "The principal currently authenticated is not a eu.etaxonomy.cdm.model.common.User", null);
53
	    }
54

    
55
		return null;
56

    
57
	}
58

    
59

    
60

    
61
}
(6-6/11)