- /**
- * Opens a new {@link DataImportEditor} for the given input
- * @param input a {@link DataImportEditorInput}
- * @throws PartInitException
- */
-// public static void open(DataImportEditorInput<?> input)
-// throws PartInitException {
-// if(input instanceof BioCaseEditorInput){
-// open(input, SpecimenImportEditor.ID);
-// }
-// else if(input instanceof GbifImportEditorInput){
-// open(input, GbifImportEditor.ID);
-// }
-// }
+ private static boolean factsVisible = true;
+
+ private static boolean mediaVisible = true;
+
+ public static void openDescriptiveDataSetEditor(UUID descriptiveDataSetUuid, EModelService modelService, EPartService partService, MApplication application){
+ Collection<MPart> parts = partService.getParts();
+ for (MPart part : parts) {
+ if(part.getObject() instanceof DescriptiveDataSetEditor
+ && ((DescriptiveDataSetEditor) part.getObject()).getDescriptiveDataSet().getUuid().equals(descriptiveDataSetUuid)){
+ partService.showPart(part, PartState.ACTIVATE);
+ return;
+ }
+ }
+ String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVEDATASET_DESCRIPTIVEDATASETEDITOR;
+ MPart part = showPart(partId, modelService, partService, application);
+ DescriptiveDataSetEditor editor = (DescriptiveDataSetEditor) part.getObject();
+ editor.init(descriptiveDataSetUuid);
+ }
+
+ public static void openCharacterMatrix(UUID descriptiveDataSetUuid, EModelService modelService, EPartService partService, MApplication application){
+ Collection<MPart> parts = partService.getParts();
+ for (MPart part : parts) {
+ if(part.getObject() instanceof CharacterMatrixPart
+ && ((CharacterMatrixPart) part.getObject()).getDescriptiveDataSet().getUuid().equals(descriptiveDataSetUuid)){
+ partService.showPart(part, PartState.ACTIVATE);
+ return;
+ }
+ }
+ String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DESCRIPTIVEDATASET_MATRIX_CHARACTERMATRIXPART;
+ MPart part = showPart(partId, modelService, partService, application);
+ CharacterMatrixPart editor = (CharacterMatrixPart) part.getObject();
+ editor.init(descriptiveDataSetUuid, true);
+ }
+
+ public static void openDistributionEditor(List<UuidAndTitleCache<ITaxonTreeNode>> parentTaxonUuidList, EModelService modelService, EPartService partService, MApplication application){
+ String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_DISTRIBUTIONEDITORPART;
+ checkAndCloseFactsAndMediaParts(partService);
+ MPart part = showPart(partId, modelService, partService, application);
+ DistributionEditorPart editor = (DistributionEditorPart) part.getObject();
+ editor.init(parentTaxonUuidList);
+ }
+
+ public static void checkAndCloseFactsAndMediaParts(EPartService partService) {
+ String partIdFactualData = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4;
+ String partIdMedia = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4;
+ MPart part1 = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4);
+ if (factsVisible || (part1!=null && part1.getWidget() != null && partService.isPartVisible(part1))){
+ factsVisible = true;
+ }else{
+ factsVisible = false;
+ }
+ part1 = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4);
+ if (mediaVisible || (part1!=null && part1.getWidget() != null && partService.isPartVisible(part1))){
+ mediaVisible = true;
+ }else{
+ mediaVisible = false;
+ }
+ closePart(partIdMedia, partService);
+ closePart(partIdFactualData, partService);
+ }
+