Revision b294e97e
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator; |
23 | 23 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
24 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
|
25 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
26 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
|
24 | 27 |
import eu.etaxonomy.cdm.model.media.Media; |
25 | 28 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
26 | 29 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
... | ... | |
67 | 70 |
} |
68 | 71 |
// TODO use undo context specific to editor |
69 | 72 |
MediaDeletionConfigurator config = new MediaDeletionConfigurator(); |
70 |
AbstractPostOperation<?> operation = new DeleteMediaOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), description, media, config, mediaView); |
|
73 |
|
|
74 |
config.setDeleteFromDescription(true); |
|
75 |
config.setOnlyRemoveFromGallery(false); |
|
76 |
|
|
77 |
if (description instanceof SpecimenDescription){ |
|
78 |
config.setDeleteFrom(((SpecimenDescription)description).getDescribedSpecimenOrObservation()); |
|
79 |
} else if (description instanceof TaxonDescription){ |
|
80 |
config.setDeleteFrom(((TaxonDescription)description).getTaxon()); |
|
81 |
}else if (description instanceof TaxonNameDescription){ |
|
82 |
config.setDeleteFrom(((TaxonNameDescription)description).getTaxonName()); |
|
83 |
} |
|
84 |
|
|
71 | 85 |
|
72 | 86 |
DeleteConfiguratorDialog dialog; |
73 | 87 |
dialog = new DeleteConfiguratorDialog(config, shell, Messages.DeleteMediaHandler_CONFIRM, null, Messages.DeleteMediaHandler_CONFIRM_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteMediaHandler_DELETE, Messages.DeleteMediaHandler_SKIP }, 0); |
... | ... | |
75 | 89 |
if (result_dialog != IStatus.OK){ |
76 | 90 |
return; |
77 | 91 |
} |
78 |
|
|
92 |
AbstractPostOperation<?> operation = new DeleteMediaOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), description, media, config, mediaView); |
|
79 | 93 |
AbstractUtility.executeOperation(operation); |
80 | 94 |
} |
81 | 95 |
} |
Also available in: Unified diff
the deleteConfig for media needs the description from where it should be deleted.