}
ImageFile image = (ImageFile) paths[0].getLastSegment();
- AbstractPostOperation operation = null;
+ AbstractPostOperation<?> operation = null;
// TODO use undo context specific to editor
MediaDeletionConfigurator config = new MediaDeletionConfigurator();
*
* @author p.ciardelli
* @created 31.03.2009
- * @version 1.0
*/
public class CreateImageOperation extends AbstractPostTaxonOperation {
this.description = description;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
return postExecute(imageFile);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
return postExecute(imageFile);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
* @author p.ciardelli
* @author n.hoffmann
* @created 05.02.2009
- * @version 1.0
*/
public class RemoveImageFromDescriptionElementOperation extends AbstractPostTaxonOperation {
- private DescriptionBase element;
+ private DescriptionBase<?> element;
private Media media;
/**
* <p>Constructor for RemoveImageFromDescriptionElementOperation.</p>
*
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param label a {@link java.lang.String} object.
- * @param config
- * @param image a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object
+ * @param media
+ * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object
+ * @param label a {@link java.lang.String} object
*/
public RemoveImageFromDescriptionElementOperation(String label,
IUndoContext undoContext, Media media,
this.element = element;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
return postExecute(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
return execute(monitor, info);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
/**
* @author n.hoffmann
* @created Mar 26, 2010
- * @version 1.0
*/
public class ImageFileElement extends MediaRepresentationPartElement<ImageFile> {
import eu.etaxonomy.cdm.common.UriUtils;
import eu.etaxonomy.cdm.common.media.ImageInfo;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.media.ImageFile;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
UriUtils.getInputStream(uri);// will fail with a FileNotFoundException if not
imageInfo = ImageInfo.NewInstance(uri, 10000);//will fail when it is no image file
singleMediaRepresentationPart.setSize((int) imageInfo.getLength());
- if(singleMediaRepresentationPart instanceof ImageFile){
- ((ImageFile) singleMediaRepresentationPart).setHeight(imageInfo.getHeight());
- ((ImageFile) singleMediaRepresentationPart).setWidth(imageInfo.getWidth());
+ if(singleMediaRepresentationPart.isInstanceOf(ImageFile.class)){
+ ImageFile image = CdmBase.deproxy(singleMediaRepresentationPart, ImageFile.class);
+ image.setHeight(imageInfo.getHeight());
+ image.setWidth(imageInfo.getWidth());
}
singleMediaRepresentationPart.getMediaRepresentation().setMimeType(imageInfo.getMimeType());
singleMediaRepresentationPart.getMediaRepresentation().setSuffix(imageInfo.getSuffix());