Revision 5a35a97d
Added by Patrick Plitzner almost 10 years ago
- added not covered switch cases in NameDetailElement
- commented null pointer access in UseObjectManager (FIXME 3.3M)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2011 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
31 | 31 |
|
32 | 32 |
/** |
33 | 33 |
* The context listener will call this class when the uses view is being loaded. |
34 |
* It checks if the uses view's necessary terms are present in the database.
|
|
35 |
* It will persist the terms that aren't present, using the CDMLib's services classes.
|
|
36 |
* @author a.theys
|
|
34 |
* It checks if the uses view's necessary terms are present in the database. |
|
35 |
* It will persist the terms that aren't present, using the CDMLib's services classes. |
|
36 |
* @author a.theys |
|
37 | 37 |
* @created mar 13, 2012 |
38 | 38 |
* @version 1.0 |
39 | 39 |
*/ |
40 | 40 |
public class UseObjectManager extends ContextListenerAdapter{ |
41 |
|
|
42 |
|
|
41 |
|
|
42 |
|
|
43 | 43 |
@Override |
44 | 44 |
public void contextRefresh(IProgressMonitor monitor) { |
45 | 45 |
monitor.subTask("Refreshing the Uses View"); |
46 | 46 |
StoreUtil.warn(getClass(), "Refreshing Uses View warn"); |
47 | 47 |
setupNecessaryItems(monitor); |
48 | 48 |
} |
49 |
|
|
50 |
|
|
49 |
|
|
50 |
|
|
51 | 51 |
@Override |
52 | 52 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
53 | 53 |
monitor.subTask("Starting the Uses View"); |
54 | 54 |
StoreUtil.warn(getClass(), "Starting Uses View warn"); |
55 | 55 |
setupNecessaryItems(monitor); |
56 | 56 |
} |
57 |
|
|
57 |
|
|
58 | 58 |
private void setupNecessaryItems(IProgressMonitor monitor) { |
59 |
|
|
59 |
|
|
60 | 60 |
//retrieve terms and vocabularies from db |
61 | 61 |
Feature featureUseRecord = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature); |
62 | 62 |
Feature featureUseSummary = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseSummaryFeature); |
63 |
|
|
63 |
|
|
64 | 64 |
ConversationHolder conversation = CdmStore.createConversation(); |
65 |
|
|
66 |
|
|
65 |
|
|
66 |
|
|
67 | 67 |
//create use marker type if not exists |
68 | 68 |
createUseMarkerType(conversation); |
69 |
|
|
69 |
|
|
70 | 70 |
//create state vocabulary if not exists |
71 | 71 |
createStateVocabulary(monitor, conversation); |
72 |
|
|
72 |
|
|
73 | 73 |
//create state vocabulary if not exists |
74 | 74 |
createCountryVocabulary(monitor, conversation); |
75 |
|
|
75 |
|
|
76 | 76 |
//create plant part vocabulary |
77 | 77 |
createPlantVocabulary(monitor, conversation); |
78 |
|
|
78 |
|
|
79 | 79 |
//create human group vocabulary |
80 | 80 |
createHumanGroupVocabulary(monitor, conversation); |
81 |
|
|
81 |
|
|
82 | 82 |
if(featureUseRecord == null || featureUseSummary == null) { |
83 |
TermVocabulary<Feature> featureVocabulary = (TermVocabulary<Feature>)CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));
|
|
83 |
TermVocabulary<Feature> featureVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary)); |
|
84 | 84 |
FeatureTree palmWebFeatureTree = CdmStore.getService(IFeatureTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree); |
85 |
|
|
85 |
|
|
86 | 86 |
if (featureUseRecord == null ) { |
87 | 87 |
featureUseRecord = Feature.NewInstance(UsageTermCollection.useRecordFeatureLabel, UsageTermCollection.useRecordFeatureLabel, null); |
88 | 88 |
featureUseRecord.setUuid(UsageTermCollection.uuidUseRecordFeature); |
... | ... | |
109 | 109 |
StoreUtil.warn(getClass(), "No current feature tree available to add use summary feature"); |
110 | 110 |
} |
111 | 111 |
} |
112 |
|
|
112 |
|
|
113 | 113 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(featureVocabulary); |
114 | 114 |
if (palmWebFeatureTree != null){ |
115 | 115 |
CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(palmWebFeatureTree); |
116 | 116 |
} |
117 | 117 |
conversation.commit(true); |
118 |
|
|
118 |
|
|
119 | 119 |
} |
120 |
conversation.close();
|
|
120 |
conversation.close(); |
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
|
124 | 124 |
private void createHumanGroupVocabulary(IProgressMonitor monitor,ConversationHolder conversation) { |
125 |
TermVocabulary<DefinedTerm> humanGroupVocabulary = (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary);
|
|
125 |
TermVocabulary<DefinedTerm> humanGroupVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary); |
|
126 | 126 |
if (humanGroupVocabulary == null){ |
127 | 127 |
monitor.subTask("create human group vocabulary"); |
128 | 128 |
URI termSourceUri = null; |
... | ... | |
131 | 131 |
} catch (URISyntaxException e) { |
132 | 132 |
e.printStackTrace(); |
133 | 133 |
} |
134 |
|
|
134 |
|
|
135 | 135 |
//FIXME:3.3MC---- |
136 | 136 |
//humanGroupVocabulary = TermVocabulary.NewInstance(UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri); |
137 |
humanGroupVocabulary = null; |
|
138 |
humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary); |
|
137 |
// humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary); |
|
139 | 138 |
//FIXME:3.3MC---- |
140 |
|
|
139 |
|
|
141 | 140 |
//FIXME:3.3MC---- |
142 | 141 |
//DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
143 |
DefinedTerm newDummyModifier = null; |
|
144 |
newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy); |
|
142 |
// newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy); |
|
145 | 143 |
//FIXME:3.3MC---- |
146 |
|
|
144 |
|
|
147 | 145 |
//FIXME:3.3MC---- |
148 | 146 |
//DefinedTerm newSubDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
149 |
DefinedTerm newSubDummyModifier = null; |
|
150 |
newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy); |
|
147 |
// newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy); |
|
148 |
// newDummyModifier.addIncludes(newSubDummyModifier); |
|
149 |
// humanGroupVocabulary.addTerm(newDummyModifier); |
|
151 | 150 |
//FIXME:3.3MC---- |
152 |
|
|
153 |
newDummyModifier.addIncludes(newSubDummyModifier); |
|
154 |
humanGroupVocabulary.addTerm(newDummyModifier); |
|
151 |
|
|
155 | 152 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary); |
156 | 153 |
conversation.commit(true); |
157 | 154 |
} |
... | ... | |
159 | 156 |
|
160 | 157 |
|
161 | 158 |
private void createPlantVocabulary(IProgressMonitor monitor, ConversationHolder conversation) { |
162 |
TermVocabulary<DefinedTerm> plantPartVocabulary = (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary);
|
|
159 |
TermVocabulary<DefinedTerm> plantPartVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary); |
|
163 | 160 |
if (plantPartVocabulary == null){ |
164 | 161 |
monitor.subTask("create plant part vocabulary"); |
165 | 162 |
URI termSourceUri = null; |
... | ... | |
170 | 167 |
} |
171 | 168 |
//FIXME:3.3MC---- |
172 | 169 |
//plantPartVocabulary = TermVocabulary.NewInstance(UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri); |
173 |
plantPartVocabulary = null; |
|
174 |
plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary); |
|
170 |
// plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary); |
|
175 | 171 |
//FIXME:3.3MC---- |
176 |
|
|
172 |
|
|
177 | 173 |
//FIXME:3.3MC---- |
178 | 174 |
//DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
179 |
DefinedTerm newDummyModifier = null; |
|
180 |
newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy); |
|
181 |
plantPartVocabulary.addTerm(newDummyModifier); |
|
175 |
// newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy); |
|
176 |
// plantPartVocabulary.addTerm(newDummyModifier); |
|
182 | 177 |
//FIXME:3.3MC---- |
183 |
|
|
178 |
|
|
184 | 179 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary); |
185 | 180 |
conversation.commit(true); |
186 | 181 |
} |
... | ... | |
188 | 183 |
|
189 | 184 |
|
190 | 185 |
private void createCountryVocabulary(IProgressMonitor monitor, ConversationHolder conversation) { |
191 |
TermVocabulary<DefinedTerm> countryVocabulary = (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary);
|
|
186 |
TermVocabulary<DefinedTerm> countryVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary); |
|
192 | 187 |
if (countryVocabulary == null){ |
193 | 188 |
monitor.subTask("create country vocabulary"); |
194 | 189 |
URI termSourceUri = null; |
... | ... | |
199 | 194 |
} |
200 | 195 |
//FIXME:3.3MC---- |
201 | 196 |
//countryVocabulary = TermVocabulary.NewInstance(UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri); |
202 |
countryVocabulary = null; |
|
203 |
countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary); |
|
197 |
// countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary); |
|
204 | 198 |
//FIXME:3.3MC---- |
205 |
|
|
199 |
|
|
206 | 200 |
//FIXME:3.3MC---- |
207 | 201 |
//DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
208 |
DefinedTerm newDummyModifier = null;
|
|
209 |
newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);
|
|
202 |
// newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);
|
|
203 |
// countryVocabulary.addTerm(newDummyModifier);
|
|
210 | 204 |
//FIXME:3.3MC---- |
211 |
countryVocabulary.addTerm(newDummyModifier); |
|
212 | 205 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary); |
213 | 206 |
conversation.commit(true); |
214 | 207 |
} |
... | ... | |
216 | 209 |
|
217 | 210 |
|
218 | 211 |
private void createStateVocabulary(IProgressMonitor monitor, ConversationHolder conversation) { |
219 |
TermVocabulary<State> stateVocabulary = (TermVocabulary<State>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary);
|
|
212 |
TermVocabulary<State> stateVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary); |
|
220 | 213 |
if (stateVocabulary == null){ |
221 | 214 |
monitor.subTask("create state vocabulary"); |
222 | 215 |
URI termSourceUri = null; |
... | ... | |
227 | 220 |
} |
228 | 221 |
//FIXME:3.3MC---- |
229 | 222 |
//stateVocabulary = TermVocabulary.NewInstance(UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri); |
230 |
stateVocabulary = null; |
|
231 |
stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary); |
|
223 |
// stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary); |
|
232 | 224 |
//FIXME:3.3MC---- |
233 | 225 |
State newDummyState = State.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
234 | 226 |
newDummyState.setUuid(UsageTermCollection.uuidUseCategoryDummy); |
235 | 227 |
State newDummySubCat = State.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null); |
236 | 228 |
newDummySubCat.setUuid(UsageTermCollection.uuidUseSubCategoryDummy); |
237 | 229 |
newDummyState.addIncludes(newDummySubCat); |
238 |
stateVocabulary.addTerm(newDummyState); |
|
230 |
//FIXME:3.3MC---- |
|
231 |
// stateVocabulary.addTerm(newDummyState); |
|
232 |
//FIXME:3.3MC---- |
|
239 | 233 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary); |
240 | 234 |
conversation.commit(true); |
241 | 235 |
} |
... | ... | |
247 | 241 |
if (useMarkertype == null){ |
248 | 242 |
useMarkertype = MarkerType.NewInstance(UsageTermCollection.useMakerLabel, UsageTermCollection.useMakerLabel, null); |
249 | 243 |
useMarkertype.setUuid( UsageTermCollection.uuidUseMarkerType); |
250 |
TermVocabulary<MarkerType> markerTypeVocabulary = (TermVocabulary<MarkerType>)CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidMarkersVocabulary));
|
|
244 |
TermVocabulary<MarkerType> markerTypeVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidMarkersVocabulary)); |
|
251 | 245 |
markerTypeVocabulary.addTerm(useMarkertype); |
252 | 246 |
CdmStore.getService(IVocabularyService.class).saveOrUpdate(markerTypeVocabulary); |
253 | 247 |
conversation.commit(true); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
12 | 12 |
|
13 | 13 |
import java.util.Arrays; |
14 | 14 |
|
15 |
import org.apache.log4j.Logger; |
|
15 | 16 |
import org.eclipse.swt.SWT; |
16 | 17 |
|
17 | 18 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
... | ... | |
40 | 41 |
*/ |
41 | 42 |
public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<NonViralName> implements ISelectableElement, IEnableableFormElement{ |
42 | 43 |
|
44 |
private final Logger logger = Logger.getLogger(NameDetailElement.class); |
|
45 |
|
|
43 | 46 |
private TermComboElement<Rank> combo_rank; |
44 | 47 |
private TextWithLabelElement text_appendedPhrase; |
45 | 48 |
private TextWithLabelElement text_uninomial; |
... | ... | |
52 | 55 |
private NumberWithLabelElement text_publicationYear; |
53 | 56 |
private NumberWithLabelElement text_originalPublicationYear; |
54 | 57 |
private int cursorPosition; |
55 |
|
|
58 |
|
|
56 | 59 |
/** |
57 | 60 |
* <p>Constructor for NameDetailElement.</p> |
58 | 61 |
* |
... | ... | |
72 | 75 |
/** {@inheritDoc} */ |
73 | 76 |
@Override |
74 | 77 |
protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) { |
75 |
|
|
78 |
|
|
76 | 79 |
toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style); |
77 |
|
|
80 |
|
|
78 | 81 |
combo_rank = formFactory.createTermComboElement(Rank.class, this, "Rank", nonViralName.getRank(), style); |
79 |
|
|
82 |
|
|
80 | 83 |
createGenusOrUninomialControls(this, nonViralName, style); |
81 | 84 |
createInfragenerericEpithetControls(this, nonViralName, style); |
82 | 85 |
createSpecificEpithetControls(this, nonViralName, style); |
83 | 86 |
createInfraSpecificEpithetControls(this, nonViralName, style); |
84 |
|
|
87 |
|
|
85 | 88 |
createSpecificNameParts(this, nonViralName, style); |
86 |
|
|
89 |
|
|
87 | 90 |
text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style); |
88 |
|
|
91 |
|
|
89 | 92 |
} |
90 | 93 |
|
91 | 94 |
/** |
... | ... | |
94 | 97 |
protected void clearCheckRankWarnings() { |
95 | 98 |
if(getEntity().hasProblem(ParserProblem.CheckRank)){ |
96 | 99 |
getEntity().removeParsingProblem(ParserProblem.CheckRank); |
97 |
|
|
100 |
|
|
98 | 101 |
// FIXME this has to be reafctored completely. See tickets #1959, #1663, #1957, #1958 |
99 | 102 |
// TaxonNameEditor nameEditor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME); |
100 | 103 |
// nameEditor.getSelectedContainer().getNameViewer().clearErrors(); |
101 | 104 |
} |
102 | 105 |
} |
103 |
|
|
106 |
|
|
104 | 107 |
/** {@inheritDoc} */ |
105 | 108 |
@Override |
106 | 109 |
protected void updateContent() { |
107 | 110 |
if(getEntity() == null){ |
108 | 111 |
setEntity(NonViralName.NewInstance(null)); |
109 | 112 |
} |
110 |
|
|
113 |
|
|
111 | 114 |
super.updateContent(); |
112 |
|
|
115 |
|
|
113 | 116 |
if(isIrrelevant()){ |
114 | 117 |
setIrrelevant(isIrrelevant()); |
115 | 118 |
}else{ |
... | ... | |
129 | 132 |
case ICZN: |
130 | 133 |
createZoologicalNameParts(formElement, nonViralName, style); |
131 | 134 |
break; |
132 |
} |
|
135 |
case ICVCN: |
|
136 |
//TODO implement |
|
137 |
logger.warn("ICVCN not yet implemented"); |
|
138 |
break; |
|
139 |
case ICNB: |
|
140 |
//TODO implement |
|
141 |
logger.warn("ICNB not yet implemented"); |
|
142 |
break; |
|
143 |
case ICNCP: |
|
144 |
//TODO implement |
|
145 |
logger.warn("ICNCP not yet implemented"); |
|
146 |
break; |
|
147 |
} |
|
133 | 148 |
} |
134 | 149 |
} |
135 |
|
|
150 |
|
|
136 | 151 |
private void createBotanicalNameParts(ICdmFormElement formElement, NonViralName nonViralName, int style){ |
137 | 152 |
BotanicalName botanicalName = (BotanicalName) nonViralName; |
138 | 153 |
checkbox_anamorphic = formFactory.createCheckbox(formElement, "Anamorphic", botanicalName.isAnamorphic(), style); |
... | ... | |
144 | 159 |
text_publicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Publication Year", zoologicalName.getPublicationYear(), style); |
145 | 160 |
text_originalPublicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Orig. Publication Year", zoologicalName.getOriginalPublicationYear(), style); |
146 | 161 |
} |
147 |
|
|
148 |
private void createGenusOrUninomialControls(ICdmFormElement element, NonViralName nonViralName, int style){
|
|
162 |
|
|
163 |
private void createGenusOrUninomialControls(ICdmFormElement element, NonViralName nonViralName, int style){ |
|
149 | 164 |
String title = "Genus"; |
150 | 165 |
Rank rank = nonViralName.getRank(); |
151 | 166 |
if(rank != null && rank.isSupraGeneric()){ |
152 |
title = "Uninomial";
|
|
167 |
title = "Uninomial"; |
|
153 | 168 |
} |
154 | 169 |
text_uninomial = formFactory.createTextWithLabelElement(element, title, nonViralName.getGenusOrUninomial(), style); |
155 | 170 |
} |
156 |
|
|
171 |
|
|
157 | 172 |
private void createInfragenerericEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){ |
158 | 173 |
if(nonViralName.getRank() != null && nonViralName.getRank().isInfraGeneric() && !nonViralName.getRank().isSpeciesAggregate()){ |
159 | 174 |
text_infragenericEpithet = formFactory.createTextWithLabelElement(element, "Infrageneric Epithet", nonViralName.getInfraGenericEpithet(), style); |
160 | 175 |
} |
161 | 176 |
} |
162 |
|
|
177 |
|
|
163 | 178 |
private void createSpecificEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){ |
164 | 179 |
if(nonViralName.getRank() != null && (nonViralName.getRank().isSpecies() || nonViralName.getRank().isInfraSpecific() || nonViralName.getRank().isSpeciesAggregate())){ |
165 | 180 |
text_specificEpithet = formFactory.createTextWithLabelElement(element, "Specific Epithet", nonViralName.getSpecificEpithet(), SWT.NULL); |
166 | 181 |
} |
167 | 182 |
} |
168 |
|
|
183 |
|
|
169 | 184 |
private void createInfraSpecificEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){ |
170 | 185 |
if(nonViralName.getRank() != null && nonViralName.getRank().isInfraSpecific()){ |
171 | 186 |
text_infraspecificEpithet = formFactory.createTextWithLabelElement(element, "Infraspecific Epithet", nonViralName.getInfraSpecificEpithet(), SWT.NULL); |
172 | 187 |
} |
173 | 188 |
} |
174 |
|
|
189 |
|
|
175 | 190 |
/** {@inheritDoc} */ |
176 | 191 |
@Override |
177 | 192 |
public void handleEvent(Object eventSource){ |
178 | 193 |
if (eventSource == toggleable_cache) { |
179 | 194 |
getEntity().setNameCache(toggleable_cache.getText(), |
180 | 195 |
toggleable_cache.getState()); |
181 |
if (!isIrrelevant()) |
|
182 |
setIrrelevant(toggleable_cache.getState(),
|
|
196 |
if (!isIrrelevant()) {
|
|
197 |
setIrrelevant(toggleable_cache.getState(),
|
|
183 | 198 |
Arrays.asList(new Object[] { toggleable_cache })); |
199 |
} |
|
184 | 200 |
} |
185 | 201 |
else if(eventSource == combo_rank){ |
186 | 202 |
getEntity().setRank(combo_rank.getSelection()); |
187 | 203 |
clearCheckRankWarnings(); |
188 | 204 |
updateContent(); |
189 |
}
|
|
205 |
} |
|
190 | 206 |
else if(eventSource == text_appendedPhrase){ |
191 | 207 |
getEntity().setAppendedPhrase(text_appendedPhrase.getText()); |
192 | 208 |
} |
... | ... | |
201 | 217 |
} |
202 | 218 |
else if(eventSource == text_uninomial){ |
203 | 219 |
getEntity().setGenusOrUninomial(text_uninomial.getText()); |
204 |
}
|
|
220 |
} |
|
205 | 221 |
else if(eventSource == checkbox_anamorphic){ |
206 | 222 |
((BotanicalName)getEntity()).setAnamorphic(checkbox_anamorphic.getSelection()); |
207 | 223 |
} |
208 | 224 |
} |
209 |
|
|
225 |
|
|
210 | 226 |
/* |
211 | 227 |
* (non-Javadoc) |
212 | 228 |
* @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#getSelectionArbitrator() |
... | ... | |
216 | 232 |
* |
217 | 233 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object. |
218 | 234 |
*/ |
219 |
public SelectionArbitrator getSelectionArbitrator() { |
|
235 |
@Override |
|
236 |
public SelectionArbitrator getSelectionArbitrator() { |
|
220 | 237 |
return selectionArbitrator; |
221 | 238 |
} |
222 |
|
|
239 |
|
|
223 | 240 |
@Override |
224 | 241 |
public void updateToggleableCacheField() { |
225 | 242 |
if(! getEntity().isProtectedNameCache()){ |
Also available in: Unified diff