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.
9 package eu
.etaxonomy
.taxeditor
.editor
.name
;
11 import org
.apache
.log4j
.Logger
;
12 import org
.eclipse
.jface
.action
.MenuManager
;
13 import org
.eclipse
.jface
.viewers
.ISelection
;
14 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
15 import org
.eclipse
.swt
.graphics
.Font
;
16 import org
.eclipse
.swt
.widgets
.Composite
;
17 import org
.eclipse
.ui
.forms
.IManagedForm
;
18 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
20 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
24 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateAutonymAction
;
25 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateConceptRelationAction
;
26 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateHeterotypicSynonymAction
;
27 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateSynonymInGroupAction
;
28 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateMisappliedNameAction
;
29 import eu
.etaxonomy
.taxeditor
.actions
.name
.CreateTaxonomicallyIncludedTaxonAction
;
30 import eu
.etaxonomy
.taxeditor
.actions
.ui
.ChangeTaxonToSynonymAction
;
31 import eu
.etaxonomy
.taxeditor
.actions
.ui
.MoveTaxonDialogAction
;
32 import eu
.etaxonomy
.taxeditor
.editor
.ContextMenu
;
33 import eu
.etaxonomy
.taxeditor
.editor
.MenuConstants
;
34 import eu
.etaxonomy
.taxeditor
.model
.CdmSessionDataRepository
;
35 import eu
.etaxonomy
.taxeditor
.propertysheet
.name
.TaxonBasePropertySource
;
42 public class AcceptedNameComposite
extends NameComposite
{
43 @SuppressWarnings("unused")
44 private static final Logger logger
= Logger
45 .getLogger(AcceptedNameComposite
.class);
47 public AcceptedNameComposite(Composite groupComposite
, IManagedForm form
,
49 super(groupComposite
, form
, NameComposite
.ACCEPTED_TAXON
, taxon
);
51 setIsDraggable(false);
52 setIcon(ACCEPTED_ICON
);
53 setFont(getViewerFont());
54 setIndent(ACCEPTED_INDENT
);
58 initTextViewer(taxon
);
61 private void createMenu() {
62 ContextMenu contextMenu
= createContextMenu();
64 contextMenu
.setMenuManager(MenuConstants
.EDITOR_TAXON_MENU());
66 // contextMenu.addAction(new CreateHeterotypicSynonymAction());
67 // contextMenu.addAction(new CreateSynonymInGroupAction());
68 // contextMenu.addSeparator();
69 // contextMenu.addAction(new CreateMisappliedNameAction());
71 // MenuManager subMenu = new MenuManager("Create concept relation");
72 // for (TaxonRelationshipType type :
73 // CdmSessionDataRepository.getDefault().getConceptRelationshipTypes()) {
74 // subMenu.add(new CreateConceptRelationAction(type));
76 // contextMenu.addSubmenu(subMenu);
77 // contextMenu.addSeparator();
78 // contextMenu.addAction(new MoveTaxonDialogAction());
79 // contextMenu.addAction(new ChangeTaxonToSynonymAction());
80 // contextMenu.addSeparator();
81 // // TODO is it correct that onlx taxa with rank species may have autonyms?
82 // // if(getTaxon().getName().getRank().equals(Rank.SPECIES())){
83 // contextMenu.addAction(new CreateAutonymAction());
85 // contextMenu.addAction(new CreateTaxonomicallyIncludedTaxonAction());
87 textViewer
.getTextWidget().setMenu(contextMenu
.getMenu());
91 public IPropertySource
getPropertySource() {
92 return new TaxonBasePropertySource(taxon
, "Accepted Name");
96 protected Font
getViewerFont() {
101 protected TaxonNameBase
getName() {
102 return taxon
.getName();
105 public Object
getData () {