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.navigation.key.polytomous.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.core.runtime.Status;
|
18
|
import org.eclipse.jface.viewers.StructuredSelection;
|
19
|
import org.eclipse.jface.wizard.WizardDialog;
|
20
|
import org.eclipse.ui.handlers.HandlerUtil;
|
21
|
|
22
|
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
|
23
|
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
|
24
|
import eu.etaxonomy.taxeditor.newWizard.NewPolytomousKeyWizard;
|
25
|
|
26
|
/**
|
27
|
* <p>NewTaxonNodeHandler class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Sep 15, 2009
|
31
|
* @version 1.0
|
32
|
*/
|
33
|
public class NewPolytomousKeyHandler extends AbstractHandler implements IHandler {
|
34
|
|
35
|
/* (non-Javadoc)
|
36
|
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
37
|
*/
|
38
|
/** {@inheritDoc} */
|
39
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
40
|
NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard();
|
41
|
wizard.init(null,null);
|
42
|
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
|
43
|
int status = dialog.open();
|
44
|
if(status == Status.OK) {
|
45
|
PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
|
46
|
//List<PolytomousKey> pklist = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
|
47
|
view.refresh();
|
48
|
view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true);
|
49
|
view.openSelectedKeyNodes();
|
50
|
}
|
51
|
return null;
|
52
|
}
|
53
|
}
|