/**
* @author pplitzner
* @since Jun 6, 2018
- *
*/
public abstract class AbstractMoveImageHandler {
+
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
MMenuItem menuItem,
TreeSelection selection = (TreeSelection) mediaView.getViewer().getSelection();
TreePath[] paths = selection.getPaths();
int count = paths[0].getSegmentCount();
- DescriptionBase description = null;
+ DescriptionBase<?> description = null;
for (int i = 0; i < count; i++ ) {
if (paths[0].getSegment(i) instanceof DescriptionBase) {
- description = (DescriptionBase) paths[0].getSegment(i);
+ description = (DescriptionBase<?>) paths[0].getSegment(i);
break;
}
}
- AbstractPostOperation operation = null;
+ AbstractPostOperation<?> operation = null;
// TODO use undo context specific to editor
operation = new MoveMediaInListOperation(menuItem.getLocalizedLabel(),
EditorUtil.getUndoContext(),
/**
- *
- */
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
package eu.etaxonomy.taxeditor.editor.view.media.handler;
import javax.inject.Named;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
/**
- *
* @author pplitzner
* @since Aug 14, 2017
- *
*/
public class CreateMediaHandler {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
- AbstractPostOperation operation = null;
+ AbstractPostOperation<?> operation = null;
// TODO use undo context specific to editor
operation = new AddMediaToImageGalleryOperation(menuItem.getLocalizedLabel(),
EditorUtil.getUndoContext(), (DescriptionBase<?>) selection.getFirstElement(), mediaView);
menuItem.setVisible(canExecute);
return canExecute;
}
-
-}
+}
\ No newline at end of file
/**
- *
- */
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
package eu.etaxonomy.taxeditor.editor.view.media.handler;
import java.util.ArrayList;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
/**
- *
* @author pplitzner
* @since Aug 15, 2017
- *
*/
public class DeleteMediaHandler {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
TreeSelection selection = (TreeSelection) mediaView.getViewer().getSelection();
- for(Iterator iter = selection.iterator();iter.hasNext();){
+ for(Iterator<?> iter = selection.iterator();iter.hasNext();){
Object object = iter.next();
TreePath[] paths = selection.getPaths();
int count = paths[0].getSegmentCount();
- DescriptionBase description = null;
+ DescriptionBase<?> description = null;
for (int i = 0; i < count; i++ ) {
if (paths[0].getSegment(i) instanceof DescriptionBase) {
- description = (DescriptionBase) paths[0].getSegment(i);
+ description = (DescriptionBase<?>) paths[0].getSegment(i);
break;
}
}
mediaList.add((Media)object);
createMediaDeleteOperation(menuItem.getLocalizedLabel(), sync, mediaView, mediaList, description, config);
}
- if(object instanceof DescriptionBase && ((DescriptionBase) object).isImageGallery()){
- if (!((DescriptionBase)object).getElements().isEmpty()){
+ if(object instanceof DescriptionBase && ((DescriptionBase<?>) object).isImageGallery()){
+ if (!((DescriptionBase<?>)object).getElements().isEmpty()){
MediaDeletionConfigurator config = fillDeleteConfigurator(shell, description, Messages.DeleteMediaHandler_CONFIRM_MESSAGE_DESCRIPTION);
if (config == null){
return;
}
- Iterator<DescriptionElementBase> elements = ((DescriptionBase)object).getElements().iterator();
+ Iterator<DescriptionElementBase> elements = ((DescriptionBase<?>)object).getElements().iterator();
DescriptionElementBase element = elements.next();
createMediaDeleteOperation(menuItem.getLocalizedLabel(), sync, mediaView, element.getMedia(), description, config);
}
}
public void createMediaDeleteOperation(String menuLabel, UISynchronize sync, MediaViewPartE4 mediaView,
- List<Media> media, DescriptionBase description, MediaDeletionConfigurator config) {
+ List<Media> media, DescriptionBase<?> description, MediaDeletionConfigurator config) {
AbstractPostOperation<?> operation = new DeleteMediaOperation(menuLabel, EditorUtil.getUndoContext(), description, media, config, mediaView);
if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4){
if (!config.isOnlyRemoveFromGallery()){
}
}
- public MediaDeletionConfigurator fillDeleteConfigurator(Shell shell, DescriptionBase description, String message) {
+ public MediaDeletionConfigurator fillDeleteConfigurator(Shell shell, DescriptionBase<?> description, String message) {
MediaDeletionConfigurator config = new MediaDeletionConfigurator();
config.setDeleteFromDescription(true);
ISelection selection = mediaView.getViewer().getSelection();
boolean canExecute = selection instanceof TreeSelection && !selection.isEmpty();
- for(Iterator iter = ((TreeSelection) selection).iterator();iter.hasNext();){
+ for(Iterator<?> iter = ((TreeSelection) selection).iterator();iter.hasNext();){
Object object = iter.next();
canExecute &= object instanceof Media
- || (object instanceof DescriptionBase && ((DescriptionBase) object).isImageGallery());
+ || (object instanceof DescriptionBase && ((DescriptionBase<?>) object).isImageGallery());
}
menuItem.setVisible(canExecute);
return canExecute;