Project

General

Profile

« Previous | Next » 

Revision 1689c57e

Added by Katja Luther over 6 years ago

only remove not persisted media in deleteOperation

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java
94 94
                else if(object instanceof SpecimenDescription){
95 95
                    DeleteSpecimenDescriptionOperation deleteTaxonDescriptionOperation = new DeleteSpecimenDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (SpecimenDescription)object, mediaView, null);
96 96
                    AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync);
97

  
97 98
                }
98 99
            }
99 100

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/DeleteMediaOperation.java
26 26
import eu.etaxonomy.cdm.model.media.Media;
27 27
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
28 28
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
29
import eu.etaxonomy.taxeditor.model.MessagingUtils;
30 29
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
31 30
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
32 31
import eu.etaxonomy.taxeditor.store.CdmStore;
......
74 73
	   // ImagesUtility.removeMediaFromGallery(description, media);
75 74

  
76 75
		monitor.worked(20);
77
		if (!config.isOnlyRemoveFromGallery()){
76
		if (!config.isOnlyRemoveFromGallery() && media.getId() != 0){
78 77
			DeleteResult result = CdmStore.getService(IMediaService.class).delete(media.getUuid(), config);
79 78
			String errorMessage = "The media ";
80
			
79

  
81 80
			if (!result.isOk()){
82 81
				List<String> messages = new ArrayList<String>();
83 82
				int i = result.getExceptions().size();
......
96 95
		} else{
97 96
			ImagesUtility.removeMediaFromGallery(description, media);
98 97
		}
99
		
98

  
100 99
		monitor.worked(40);
101 100

  
102 101
		return postExecute(null);

Also available in: Unified diff