1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 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
|
package eu.etaxonomy.taxeditor.ui.section.name;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import org.eclipse.core.runtime.IStatus;
|
15
|
import org.eclipse.jface.wizard.WizardDialog;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
18
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
19
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
|
20
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
21
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
23
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
25
|
|
26
|
/**
|
27
|
* @author pplitzner
|
28
|
* @date 27.01.2014
|
29
|
*
|
30
|
*/
|
31
|
public class SynonymRelationshipDetailSection extends AbstractEntityCollectionSection<Synonym, SynonymRelationship> {
|
32
|
|
33
|
/**
|
34
|
* <p>Constructor for NameRelationshipDetailSection.</p>
|
35
|
*
|
36
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
37
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
38
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
39
|
* @param style a int.
|
40
|
*/
|
41
|
public SynonymRelationshipDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
|
42
|
ICdmFormElement parentElement, int style) {
|
43
|
super(formFactory, conversation, parentElement, "Synonym Relationship", style);
|
44
|
}
|
45
|
|
46
|
/** {@inheritDoc} */
|
47
|
@Override
|
48
|
public void addElement(SynonymRelationship element) {
|
49
|
// nothing
|
50
|
}
|
51
|
|
52
|
/** {@inheritDoc} */
|
53
|
@Override
|
54
|
public SynonymRelationship createNewElement() {
|
55
|
|
56
|
SynonymRelationshipWizard wizard = new SynonymRelationshipWizard(this);
|
57
|
WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
|
58
|
int status = dialog.open();
|
59
|
|
60
|
if(status == IStatus.OK) {
|
61
|
return wizard.getSynonymRelationship();
|
62
|
}
|
63
|
|
64
|
return null;
|
65
|
}
|
66
|
|
67
|
/** {@inheritDoc} */
|
68
|
@Override
|
69
|
public Collection<SynonymRelationship> getCollection(Synonym entity) {
|
70
|
Collection<SynonymRelationship> allSynonymRelationships = entity.getSynonymRelations();
|
71
|
return allSynonymRelationships;
|
72
|
}
|
73
|
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public String getEmptyString() {
|
77
|
return "No synonym relationships yet.";
|
78
|
}
|
79
|
|
80
|
/** {@inheritDoc} */
|
81
|
@Override
|
82
|
protected String getTooltipString() {
|
83
|
return "Add a new synonym relationship from this name.";
|
84
|
}
|
85
|
|
86
|
/** {@inheritDoc} */
|
87
|
@Override
|
88
|
public void removeElement(SynonymRelationship element) {
|
89
|
getEntity().removeSynonymRelation(element);
|
90
|
}
|
91
|
|
92
|
}
|