Revision bd122e26
Added by Katja Luther over 1 year ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java | ||
---|---|---|
40 | 40 |
import eu.etaxonomy.cdm.model.media.Media; |
41 | 41 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
42 | 42 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
43 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditor;
|
|
43 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor; |
|
44 | 44 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteSpecimenDescriptionOperation; |
45 | 45 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteTaxonDescriptionOperation; |
46 | 46 |
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4; |
... | ... | |
84 | 84 |
DescriptionElementBase element = elements.iterator().next(); |
85 | 85 |
Set<Media> toDelete = new HashSet<>(); |
86 | 86 |
element.removeMedia((Media)object); |
87 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
|
|
87 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw(); |
|
88 | 88 |
return; |
89 | 89 |
|
90 | 90 |
} |
... | ... | |
133 | 133 |
if(object instanceof TaxonDescription){ |
134 | 134 |
|
135 | 135 |
DeleteTaxonDescriptionOperation deleteTaxonDescriptionOperation = new DeleteTaxonDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (TaxonDescription)object, mediaView, null); |
136 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditor){
|
|
137 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).getTaxon().removeDescription((TaxonDescription)description);
|
|
138 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
|
|
139 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
|
|
140 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
|
|
136 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){ |
|
137 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getTaxon().removeDescription((TaxonDescription)description); |
|
138 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation); |
|
139 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty(); |
|
140 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw(); |
|
141 | 141 |
|
142 | 142 |
}else{ |
143 | 143 |
AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync); |
... | ... | |
145 | 145 |
} |
146 | 146 |
else if(object instanceof SpecimenDescription){ |
147 | 147 |
DeleteSpecimenDescriptionOperation deleteTaxonDescriptionOperation = new DeleteSpecimenDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (SpecimenDescription)object, mediaView, null); |
148 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditor){
|
|
149 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
|
|
150 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
|
|
151 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
|
|
148 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){ |
|
149 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation); |
|
150 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty(); |
|
151 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw(); |
|
152 | 152 |
}else{ |
153 | 153 |
AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync); |
154 | 154 |
} |
... | ... | |
160 | 160 |
public void createMediaDeleteOperation(String menuLabel, UISynchronize sync, MediaViewPartE4 mediaView, |
161 | 161 |
List<Media> media, DescriptionBase<?> description, MediaDeletionConfigurator config) { |
162 | 162 |
AbstractPostOperation<?> operation = new DeleteMediaOperation(menuLabel, EditorUtil.getUndoContext(), description, media, config, mediaView); |
163 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditor){
|
|
163 |
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){ |
|
164 | 164 |
if (!config.isOnlyRemoveFromGallery()){ |
165 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation);
|
|
165 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation); |
|
166 | 166 |
} |
167 | 167 |
|
168 | 168 |
if (description.isImageGallery()){ |
... | ... | |
179 | 179 |
} |
180 | 180 |
} |
181 | 181 |
|
182 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
|
|
183 |
((TaxonNameEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
|
|
182 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty(); |
|
183 |
((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw(); |
|
184 | 184 |
}else{ |
185 | 185 |
AbstractUtility.executeOperation(operation, sync); |
186 | 186 |
} |
Also available in: Unified diff
rename TaxonNameEditor to TaxonEditor and NameViewerE4 to NameViewer