Revision df601566
Added by Katja Luther about 7 years ago
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties | ||
---|---|---|
153 | 153 |
command.name.44 = Deep Delete |
154 | 154 |
command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon |
155 | 155 |
command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon |
156 |
command.name.57 = Set as Basionym of Homotypical Group |
|
157 |
command.label.57 = Set as Basionym of Homotypical Group |
|
158 |
|
|
156 | 159 |
markerContentGenerator.name = Validation Problems Marker Generator |
157 | 160 |
command.name.45 = Delete |
158 | 161 |
command.name.47 = Delete |
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties | ||
---|---|---|
26 | 26 |
command.label.6 = Konzeptrelationen |
27 | 27 |
command.label.7 = Konzeptgraph |
28 | 28 |
command.label.8 = \u00d6ffne Parent |
29 |
menu.label = Neue
|
|
29 |
menu.label = Neu |
|
30 | 30 |
command.label.9 = Heterotypisches Synonym |
31 | 31 |
command.label.10 = Homotypisches Synonym |
32 | 32 |
command.label.11 = Synonym in Homotypischer Gruppe |
... | ... | |
68 | 68 |
command.label.43 = \u00d6ffne verbundenes Konzept |
69 | 69 |
command.label.44 = L\u00f6schen |
70 | 70 |
command.label.45 = Bearbeite Rechte |
71 |
command.label.57 = Setze als Basionym der homotypischen Gruppe |
|
71 | 72 |
extension.name = Namensbefehle |
72 | 73 |
category.name.0 = -- Namenseditor |
73 | 74 |
command.name = \u00d6ffne Elter |
... | ... | |
162 | 163 |
command.name.49 = L\u00f6schen |
163 | 164 |
command.name.50 = L\u00f6schen |
164 | 165 |
command.name.51 = L\u00f6schen |
166 |
command.name.57 = Setze als Basionym |
|
165 | 167 |
|
166 | 168 |
editor.name.DERIVATIVE_EDITOR = Specimen-Editor |
167 | 169 |
command.label.DERIVATIVE_EDITOR = Specimen-Editor |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
610 | 610 |
definitionId="isSynonym"> |
611 | 611 |
</reference> |
612 | 612 |
</visibleWhen> |
613 |
</command> |
|
614 |
<command |
|
615 |
commandId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym" |
|
616 |
label="%command.label.57" |
|
617 |
style="push"> |
|
618 |
<visibleWhen> |
|
619 |
<reference |
|
620 |
definitionId="isSynonymInHomotypicalGroupWithMoreSynonyms"> |
|
621 |
</reference> |
|
622 |
</visibleWhen> |
|
613 | 623 |
</command> |
614 | 624 |
<command |
615 | 625 |
commandId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon" |
... | ... | |
1361 | 1371 |
defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler" |
1362 | 1372 |
id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted" |
1363 | 1373 |
name="%command.name.6"> |
1374 |
</command> |
|
1375 |
<command |
|
1376 |
categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category" |
|
1377 |
defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler" |
|
1378 |
id="eu.etaxonomy.taxeditor.editor.name.setAsBasionym" |
|
1379 |
name="%command.name.57"> |
|
1364 | 1380 |
</command> |
1365 | 1381 |
<command |
1366 | 1382 |
categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category" |
... | ... | |
1706 | 1722 |
property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isNotHomotypicSynonymOfAcceptedTaxon"> |
1707 | 1723 |
</test> |
1708 | 1724 |
</with> |
1725 |
</definition> |
|
1726 |
<definition |
|
1727 |
id="isSynonymInHomotypicalGroupWithMoreSynonyms"> |
|
1728 |
<with |
|
1729 |
variable="selection"> |
|
1730 |
<test |
|
1731 |
property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isSynonymInHomotypicalGroupWithMoreSynonyms"> |
|
1732 |
</test> |
|
1733 |
</with> |
|
1709 | 1734 |
</definition> |
1710 | 1735 |
<definition |
1711 | 1736 |
id="isSynonym"> |
... | ... | |
1909 | 1934 |
class="eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester" |
1910 | 1935 |
id="eu.etaxonomy.taxeditor.editor.name.propertyTester" |
1911 | 1936 |
namespace="eu.etaxonomy.taxeditor.editor.name.propertyTester" |
1912 |
properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon" |
|
1937 |
properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms"
|
|
1913 | 1938 |
type="org.eclipse.jface.viewers.IStructuredSelection"> |
1914 | 1939 |
</propertyTester> |
1915 | 1940 |
<propertyTester |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/GroupBasionymContributionItem.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package eu.etaxonomy.taxeditor.editor.name.handler; |
|
5 |
|
|
6 |
import org.apache.log4j.Logger; |
|
7 |
import org.eclipse.jface.action.IContributionItem; |
|
8 |
import org.eclipse.jface.viewers.ISelection; |
|
9 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
10 |
import org.eclipse.swt.SWT; |
|
11 |
import org.eclipse.ui.ISelectionService; |
|
12 |
import org.eclipse.ui.IWorkbenchWindow; |
|
13 |
import org.eclipse.ui.PlatformUI; |
|
14 |
import org.eclipse.ui.actions.CompoundContributionItem; |
|
15 |
import org.eclipse.ui.menus.CommandContributionItem; |
|
16 |
import org.eclipse.ui.menus.CommandContributionItemParameter; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
19 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
|
20 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
21 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
22 |
import eu.etaxonomy.taxeditor.labels.ILabelImageStrategy; |
|
23 |
import eu.etaxonomy.taxeditor.labels.LabelImageProvider; |
|
24 |
|
|
25 |
/** |
|
26 |
* <p>GroupBasionymContributionItem class.</p> |
|
27 |
* |
|
28 |
* @author p.ciardelli |
|
29 |
* @version $Id: $ |
|
30 |
*/ |
|
31 |
public class GroupBasionymContributionItem extends CompoundContributionItem { |
|
32 |
@SuppressWarnings("unused") |
|
33 |
private static final Logger logger = Logger.getLogger(GroupBasionymContributionItem.class); |
|
34 |
|
|
35 |
/** |
|
36 |
* <p>Constructor for GroupBasionymContributionItem.</p> |
|
37 |
*/ |
|
38 |
public GroupBasionymContributionItem() {} |
|
39 |
|
|
40 |
/** |
|
41 |
* <p>Constructor for GroupBasionymContributionItem.</p> |
|
42 |
* |
|
43 |
* @param id a {@link java.lang.String} object. |
|
44 |
*/ |
|
45 |
public GroupBasionymContributionItem(String id) { |
|
46 |
super(id); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
/** {@inheritDoc} */ |
|
51 |
@Override |
|
52 |
protected IContributionItem[] getContributionItems() { |
|
53 |
|
|
54 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
|
55 |
|
|
56 |
ISelectionService selectionService = window.getSelectionService(); |
|
57 |
|
|
58 |
ISelection selection = selectionService.getSelection(); |
|
59 |
|
|
60 |
if(selection instanceof IStructuredSelection){ |
|
61 |
Object selectedObject = ((IStructuredSelection) selection).getFirstElement(); |
|
62 |
|
|
63 |
if(selectedObject != null && selectedObject instanceof TaxonBase){ |
|
64 |
|
|
65 |
TaxonNameBase name = (TaxonNameBase) HibernateProxyHelper.deproxy(((TaxonBase) selectedObject).getName()); |
|
66 |
|
|
67 |
if(name != null && name.getHomotypicalGroup().getTypifiedNames().size() > 1){ |
|
68 |
|
|
69 |
CommandContributionItemParameter parameter = |
|
70 |
new CommandContributionItemParameter( |
|
71 |
window, null, getCommand(name), SWT.NONE); |
|
72 |
|
|
73 |
parameter.label = getLabel(name); |
|
74 |
|
|
75 |
return new IContributionItem[] { |
|
76 |
new CommandContributionItem(parameter) |
|
77 |
}; |
|
78 |
} |
|
79 |
|
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
return new IContributionItem[]{}; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* @param name |
|
88 |
* @return |
|
89 |
*/ |
|
90 |
private String getCommand(TaxonNameBase name) { |
|
91 |
if(name.isGroupsBasionym()){ |
|
92 |
return "eu.etaxonomy.taxeditor.editor.name.removeBasionym" ; |
|
93 |
} |
|
94 |
return "eu.etaxonomy.taxeditor.editor.name.setBasionym"; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* @param name |
|
99 |
* @return |
|
100 |
*/ |
|
101 |
private String getLabel(TaxonNameBase name) { |
|
102 |
ILabelImageStrategy strategy = LabelImageProvider.getLabelStrategy(name); |
|
103 |
LabelImageProvider labelProvider = new LabelImageProvider(strategy); |
|
104 |
return (name.isGroupsBasionym() ? "Remove" : "Set") |
|
105 |
+ " as " + labelProvider.getNameRelationTypeDescription(NameRelationshipType.BASIONYM()) + " for Homotypic Group"; |
|
106 |
} |
|
107 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java | ||
---|---|---|
36 | 36 |
private static final String EMPTY_NAMES = "hasEmptyNames"; |
37 | 37 |
private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms"; |
38 | 38 |
private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon"; |
39 |
|
|
39 |
private static final String SYNONYM_WITH_HOMOTYPIC_SYNONYMS = "isSynonymInHomotypicalGroupWithMoreSynonyms"; |
|
40 | 40 |
|
41 | 41 |
/** |
42 | 42 |
* <p>Constructor for NameEditorMenuPropertyTester.</p> |
... | ... | |
78 | 78 |
} |
79 | 79 |
else if(ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS.equals(property)){ |
80 | 80 |
return isAcceptedAndHasNoHomotypicSynonyms(selectedElement); |
81 |
}else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){ |
|
81 |
} |
|
82 |
else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){ |
|
82 | 83 |
return isNotHomotypicSynonymOfAcceptedTaxon(selectedElement); |
83 | 84 |
} |
85 |
else if (SYNONYM_WITH_HOMOTYPIC_SYNONYMS.equals(property)){ |
|
86 |
return isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement); |
|
87 |
} |
|
84 | 88 |
|
85 | 89 |
} |
86 | 90 |
|
... | ... | |
95 | 99 |
} |
96 | 100 |
return false; |
97 | 101 |
} |
102 |
|
|
103 |
private boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) { |
|
104 |
if (isSynonym(selectedElement)){ |
|
105 |
Synonym synonym = (Synonym) selectedElement; |
|
106 |
return synonym.getHomotypicGroup().getTypifiedNames().size()>1; |
|
107 |
} |
|
108 |
return false; |
|
109 |
} |
|
110 |
|
|
98 | 111 |
|
99 | 112 |
private boolean isNotHomotypicSynonymOfAcceptedTaxon(Object selectedElement) { |
100 | 113 |
if (isSynonym(selectedElement)){ |
Also available in: Unified diff
translate some commands