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
.name
;
12 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
13 import org
.eclipse
.jface
.viewers
.CellEditor
;
14 import org
.eclipse
.jface
.viewers
.DialogCellEditor
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.swt
.widgets
.Control
;
17 import org
.eclipse
.ui
.views
.properties
.PropertyDescriptor
;
19 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
20 import eu
.etaxonomy
.cdm
.model
.agent
.INomenclaturalAuthor
;
21 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
22 import eu
.etaxonomy
.taxeditor
.dialogs
.filteredSelection
.FilteredAgentSelectionDialog
;
23 import eu
.etaxonomy
.taxeditor
.dialogs
.filteredSelection
.FilteredTeamOrPersonBaseSelectionDialog
;
30 public class AuthorshipSearchDescriptor
extends PropertyDescriptor
{
32 private TeamOrPersonBase teamOrPerson
;
34 public AuthorshipSearchDescriptor(Object id
, String displayName
) {
35 super(id
, displayName
);
39 * @param idAuthorshipcache
40 * @param authorshipcache
41 * @param combinationAuthorTeam
43 public AuthorshipSearchDescriptor(Object id
, String displayName
, TeamOrPersonBase teamOrPerson
) {
44 this(id
, displayName
);
45 this.teamOrPerson
= teamOrPerson
;
48 public CellEditor
createPropertyEditor(Composite parent
) {
49 CellEditor editor
= new DialogCellEditor(parent
) {
52 * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control)
54 protected Object
openDialogBox(
55 Control cellEditorWindow
) {
56 // AgentBase agent = FilteredAgentSelectionDialog.selectAgent(cellEditorWindow.getShell(), teamOrPerson);
57 AgentBase agent
= FilteredTeamOrPersonBaseSelectionDialog
.selectTeamOrPersonBase(cellEditorWindow
.getShell(), teamOrPerson
);
58 if (agent
instanceof INomenclaturalAuthor
) {
61 MessageDialog
.openError(cellEditorWindow
.getShell(), "Not a nomenclatural author",
62 "'" + agent
.getTitleCache() + "' is not a nomenclatural author.");
67 if (getValidator() != null) {
68 editor
.setValidator(getValidator());