Massive refactoring of the methodology in former class UiUtils
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / actions / ui / OpenNameRelationsListWizardAction.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.actions.ui;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.jface.wizard.Wizard;
16 import org.eclipse.jface.wizard.WizardDialog;
17
18 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
19 import eu.etaxonomy.taxeditor.ITaxEditorConstants;
20 import eu.etaxonomy.taxeditor.TaxEditorPlugin;
21 import eu.etaxonomy.taxeditor.controller.GlobalController;
22 import eu.etaxonomy.taxeditor.propertysheet.namerelationswizard.NameRelationsListWizard;
23
24 /**
25 * @author p.ciardelli
26 * @created 04.06.2008
27 * @version 1.0
28 */
29 public class OpenNameRelationsListWizardAction extends Action {
30 private static final Logger logger = Logger
31 .getLogger(OpenNameRelationsListWizardAction.class);
32
33 private static String text = "Create name relation ...";
34 private ImageDescriptor image = TaxEditorPlugin.getDefault()
35 .getImageDescriptor(ITaxEditorConstants.ACTIVE_DELETE_ICON);
36 // private ImageDescriptor image = null;
37 public static final String ID = "eu.etaxonomy.taxeditor.actions.opennamerelationswizard"; //$NON-NLS-1$
38
39 private TaxonNameBase name;
40
41 private OpenNameRelationsListWizardAction() {
42 super(text);
43 setImageDescriptor(image);
44 setId(ID);
45 }
46
47 public OpenNameRelationsListWizardAction(TaxonNameBase name) {
48 this();
49
50 this.name = name;
51 }
52
53 public void run() {
54 if (name == null) {
55 return;
56 }
57 Wizard wizard = new NameRelationsListWizard(name);
58
59 // Instantiates the wizard container with the wizard and opens it
60 WizardDialog dialog = new WizardDialog(GlobalController.getShell(), wizard);
61 dialog.create();
62 dialog.open();
63 }
64 }