Revision 77123730
Added by Andreas Müller over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java | ||
---|---|---|
67 | 67 |
} |
68 | 68 |
ImageFile image = (ImageFile) paths[0].getLastSegment(); |
69 | 69 |
|
70 |
AbstractPostOperation operation = null; |
|
70 |
AbstractPostOperation<?> operation = null;
|
|
71 | 71 |
// TODO use undo context specific to editor |
72 | 72 |
MediaDeletionConfigurator config = new MediaDeletionConfigurator(); |
73 | 73 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/CreateImageOperation.java | ||
---|---|---|
27 | 27 |
* |
28 | 28 |
* @author p.ciardelli |
29 | 29 |
* @created 31.03.2009 |
30 |
* @version 1.0 |
|
31 | 30 |
*/ |
32 | 31 |
public class CreateImageOperation extends AbstractPostTaxonOperation { |
33 | 32 |
|
... | ... | |
67 | 66 |
this.description = description; |
68 | 67 |
} |
69 | 68 |
|
70 |
/* (non-Javadoc) |
|
71 |
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
72 |
*/ |
|
73 | 69 |
/** {@inheritDoc} */ |
74 | 70 |
@Override |
75 | 71 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
... | ... | |
86 | 82 |
return postExecute(imageFile); |
87 | 83 |
} |
88 | 84 |
|
89 |
/* (non-Javadoc) |
|
90 |
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
91 |
*/ |
|
92 | 85 |
/** {@inheritDoc} */ |
93 | 86 |
@Override |
94 | 87 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
... | ... | |
99 | 92 |
return postExecute(imageFile); |
100 | 93 |
} |
101 | 94 |
|
102 |
/* (non-Javadoc) |
|
103 |
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
104 |
*/ |
|
105 | 95 |
/** {@inheritDoc} */ |
106 | 96 |
@Override |
107 | 97 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/RemoveImageFromDescriptionElementOperation.java | ||
---|---|---|
27 | 27 |
* @author p.ciardelli |
28 | 28 |
* @author n.hoffmann |
29 | 29 |
* @created 05.02.2009 |
30 |
* @version 1.0 |
|
31 | 30 |
*/ |
32 | 31 |
public class RemoveImageFromDescriptionElementOperation extends AbstractPostTaxonOperation { |
33 | 32 |
|
34 |
private DescriptionBase element; |
|
33 |
private DescriptionBase<?> element;
|
|
35 | 34 |
private Media media; |
36 | 35 |
|
37 | 36 |
/** |
38 | 37 |
* <p>Constructor for RemoveImageFromDescriptionElementOperation.</p> |
39 | 38 |
* |
40 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
41 |
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
|
42 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object. |
|
43 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
44 |
* @param label a {@link java.lang.String} object. |
|
45 |
* @param config |
|
46 |
* @param image a {@link eu.etaxonomy.cdm.model.media.ImageFile} object. |
|
39 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object |
|
40 |
* @param media |
|
41 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object |
|
42 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object |
|
43 |
* @param label a {@link java.lang.String} object |
|
47 | 44 |
*/ |
48 | 45 |
public RemoveImageFromDescriptionElementOperation(String label, |
49 | 46 |
IUndoContext undoContext, Media media, |
... | ... | |
54 | 51 |
this.element = element; |
55 | 52 |
} |
56 | 53 |
|
57 |
/* (non-Javadoc) |
|
58 |
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
59 |
*/ |
|
60 | 54 |
/** {@inheritDoc} */ |
61 | 55 |
@Override |
62 | 56 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
... | ... | |
69 | 63 |
return postExecute(element); |
70 | 64 |
} |
71 | 65 |
|
72 |
/* (non-Javadoc) |
|
73 |
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
74 |
*/ |
|
75 | 66 |
/** {@inheritDoc} */ |
76 | 67 |
@Override |
77 | 68 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
... | ... | |
79 | 70 |
return execute(monitor, info); |
80 | 71 |
} |
81 | 72 |
|
82 |
/* (non-Javadoc) |
|
83 |
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
84 |
*/ |
|
85 | 73 |
/** {@inheritDoc} */ |
86 | 74 |
@Override |
87 | 75 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ImageFileElement.java | ||
---|---|---|
29 | 29 |
/** |
30 | 30 |
* @author n.hoffmann |
31 | 31 |
* @created Mar 26, 2010 |
32 |
* @version 1.0 |
|
33 | 32 |
*/ |
34 | 33 |
public class ImageFileElement extends MediaRepresentationPartElement<ImageFile> { |
35 | 34 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import eu.etaxonomy.cdm.common.UriUtils; |
20 | 20 |
import eu.etaxonomy.cdm.common.media.ImageInfo; |
21 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
21 | 22 |
import eu.etaxonomy.cdm.model.media.ImageFile; |
22 | 23 |
import eu.etaxonomy.cdm.model.media.Media; |
23 | 24 |
import eu.etaxonomy.cdm.model.media.MediaRepresentation; |
... | ... | |
100 | 101 |
UriUtils.getInputStream(uri);// will fail with a FileNotFoundException if not |
101 | 102 |
imageInfo = ImageInfo.NewInstance(uri, 10000);//will fail when it is no image file |
102 | 103 |
singleMediaRepresentationPart.setSize((int) imageInfo.getLength()); |
103 |
if(singleMediaRepresentationPart instanceof ImageFile){ |
|
104 |
((ImageFile) singleMediaRepresentationPart).setHeight(imageInfo.getHeight()); |
|
105 |
((ImageFile) singleMediaRepresentationPart).setWidth(imageInfo.getWidth()); |
|
104 |
if(singleMediaRepresentationPart.isInstanceOf(ImageFile.class)){ |
|
105 |
ImageFile image = CdmBase.deproxy(singleMediaRepresentationPart, ImageFile.class); |
|
106 |
image.setHeight(imageInfo.getHeight()); |
|
107 |
image.setWidth(imageInfo.getWidth()); |
|
106 | 108 |
} |
107 | 109 |
singleMediaRepresentationPart.getMediaRepresentation().setMimeType(imageInfo.getMimeType()); |
108 | 110 |
singleMediaRepresentationPart.getMediaRepresentation().setSuffix(imageInfo.getSuffix()); |
Also available in: Unified diff
cleanup and deproxy