2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.propertysheet
.type
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.viewers
.CellEditor
;
14 import org
.eclipse
.jface
.viewers
.DialogCellEditor
;
15 import org
.eclipse
.jface
.wizard
.Wizard
;
16 import org
.eclipse
.jface
.wizard
.WizardDialog
;
17 import org
.eclipse
.swt
.widgets
.Composite
;
18 import org
.eclipse
.swt
.widgets
.Control
;
19 import org
.eclipse
.ui
.views
.properties
.PropertyDescriptor
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
22 import eu
.etaxonomy
.taxeditor
.controller
.GlobalController
;
23 import eu
.etaxonomy
.taxeditor
.model
.CdmUtil
;
24 import eu
.etaxonomy
.taxeditor
.propertysheet
.type
.wizard
.TypeListWizard
;
27 * Property sheet descriptor that pops up a dialog window
34 public class TypePropertyDescriptor
extends PropertyDescriptor
{
35 private static final Logger logger
= Logger
36 .getLogger(TypePropertyDescriptor
.class);
38 private TaxonNameBase name
;
40 public TypePropertyDescriptor(Object id
, String displayName
, TaxonNameBase name
) {
41 super(id
, displayName
);
45 public CellEditor
createPropertyEditor(Composite parent
) {
46 CellEditor editor
= new DialogCellEditor(parent
) {
49 protected Object
openDialogBox(
50 Control cellEditorWindow
) {
52 Wizard wizard
= new TypeListWizard(name
);
54 // Instantiates the wizard container with the wizard and opens it
55 WizardDialog dialog
= new WizardDialog(GlobalController
.getShell(), wizard
);
59 if (CdmUtil
.isNameSupraSpecific(name
)) {
60 return new TypeCollectionPropertySource(name
, name
.getNameTypeDesignations());
62 return new TypeCollectionPropertySource(name
, name
.getSpecimenTypeDesignations());
67 if (getValidator() != null) {
68 editor
.setValidator(getValidator());