Revision 2c450f49
Added by Patrick Plitzner over 4 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixBottomToolbar.java | ||
---|---|---|
49 | 49 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
50 | 50 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
51 | 51 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
52 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
53 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
54 | 52 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
55 | 53 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
56 | 54 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonSelectionDialog; |
... | ... | |
144 | 142 |
aggregatDescriptiveDataSet(matrix.getDescriptiveDataSet().getUuid()); |
145 | 143 |
} |
146 | 144 |
}); |
147 |
if(PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES)){ |
|
148 |
/** |
|
149 |
* Key generation button |
|
150 |
*/ |
|
151 |
Button btnGenerateKey = new Button(this, SWT.PUSH); |
|
152 |
btnGenerateKey.setText("Generate Polytomous Key"); |
|
153 |
btnGenerateKey.addSelectionListener(new SelectionAdapter() { |
|
154 |
@Override |
|
155 |
public void widgetSelected(SelectionEvent e) { |
|
156 |
if(StoreUtil.promptCheckIsDirty(matrix.getPart())){ |
|
157 |
return; |
|
158 |
} |
|
159 |
Set<TaxonNodeDto> nodeDtos = matrix.getDescriptiveDataSet().getTaxonSubtreeFilter().stream() |
|
160 |
.map(node->new TaxonNodeDto(node)) |
|
161 |
.collect(Collectors.toSet()); |
|
162 |
TaxonNodeDto parentDto = CdmStore.getService(ITaxonNodeService.class).findCommonParentDto(nodeDtos); |
|
163 |
UUID taxonUuid = parentDto.getTaxonUuid(); |
|
164 |
int response = MessagingUtils.confirmDialog( |
|
165 |
"Choose taxonomic scope", |
|
166 |
String.format("The common parent taxon of this data set is :\n%s\n\n" |
|
167 |
+ "Do you want to use this as the taxonomic scope for the polytomous key?" |
|
168 |
, parentDto.getTaxonTitleCache()), "Yes", "Choose different taxon", "Cancel"); |
|
169 |
if(response==2){ |
|
145 |
/** |
|
146 |
* Key generation button |
|
147 |
*/ |
|
148 |
Button btnGenerateKey = new Button(this, SWT.PUSH); |
|
149 |
btnGenerateKey.setText("Generate Polytomous Key"); |
|
150 |
btnGenerateKey.addSelectionListener(new SelectionAdapter() { |
|
151 |
@Override |
|
152 |
public void widgetSelected(SelectionEvent e) { |
|
153 |
if(StoreUtil.promptCheckIsDirty(matrix.getPart())){ |
|
154 |
return; |
|
155 |
} |
|
156 |
Set<TaxonNodeDto> nodeDtos = matrix.getDescriptiveDataSet().getTaxonSubtreeFilter().stream() |
|
157 |
.map(node->new TaxonNodeDto(node)) |
|
158 |
.collect(Collectors.toSet()); |
|
159 |
TaxonNodeDto parentDto = CdmStore.getService(ITaxonNodeService.class).findCommonParentDto(nodeDtos); |
|
160 |
UUID taxonUuid = parentDto.getTaxonUuid(); |
|
161 |
int response = MessagingUtils.confirmDialog( |
|
162 |
"Choose taxonomic scope", |
|
163 |
String.format("The common parent taxon of this data set is :\n%s\n\n" |
|
164 |
+ "Do you want to use this as the taxonomic scope for the polytomous key?" |
|
165 |
, parentDto.getTaxonTitleCache()), "Yes", "Choose different taxon", "Cancel"); |
|
166 |
if(response==2){ |
|
167 |
return; |
|
168 |
} |
|
169 |
else if(response==1){ |
|
170 |
Taxon taxon = TaxonSelectionDialog.selectTaxon(getShell(), null); |
|
171 |
if(taxon==null){ |
|
170 | 172 |
return; |
171 | 173 |
} |
172 |
else if(response==1){ |
|
173 |
Taxon taxon = TaxonSelectionDialog.selectTaxon(getShell(), null); |
|
174 |
if(taxon==null){ |
|
175 |
return; |
|
176 |
} |
|
177 |
taxonUuid = taxon.getUuid(); |
|
178 |
} |
|
179 |
generateKey(matrix.getDescriptiveDataSet().getUuid(), taxonUuid); |
|
174 |
taxonUuid = taxon.getUuid(); |
|
180 | 175 |
} |
176 |
generateKey(matrix.getDescriptiveDataSet().getUuid(), taxonUuid); |
|
177 |
} |
|
181 | 178 |
|
182 |
}); |
|
183 |
} |
|
179 |
}); |
|
184 | 180 |
} |
185 | 181 |
|
186 | 182 |
private void aggregatDescriptiveDataSet(UUID descriptiveDataSetUuid){ |
Also available in: Unified diff
Remove "experimental" status from