Revision e3895566
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
import java.util.Set; |
15 | 15 |
|
16 |
import org.apache.commons.imaging.ImageReadException; |
|
16 | 17 |
import org.apache.http.HttpException; |
17 | 18 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 | 19 |
import org.eclipse.core.runtime.IStatus; |
... | ... | |
20 | 21 |
import org.eclipse.core.runtime.jobs.Job; |
21 | 22 |
import org.eclipse.swt.SWT; |
22 | 23 |
import org.eclipse.swt.widgets.Label; |
23 |
import org.apache.commons.imaging.ImageReadException; |
|
24 | 24 |
|
25 | 25 |
import eu.etaxonomy.cdm.common.UriUtils; |
26 | 26 |
import eu.etaxonomy.cdm.common.media.CdmImageInfo; |
... | ... | |
50 | 50 |
|
51 | 51 |
private static final String LOAD_IMAGE = Messages.MediaDetailElement_LOAD_IMAGE; |
52 | 52 |
|
53 |
private boolean isShowImage = true; |
|
54 |
|
|
53 | 55 |
/** |
54 | 56 |
* @author pplitzner |
55 | 57 |
* @since Jul 11, 2019 |
... | ... | |
66 | 68 |
protected IStatus run(IProgressMonitor monitor) { |
67 | 69 |
try { |
68 | 70 |
//first check if uri refers to an actual (non-image) file |
71 |
|
|
69 | 72 |
UriUtils.getInputStream(uri);// will fail with a FileNotFoundException if not |
73 |
|
|
70 | 74 |
CdmImageInfo imageInfo = CdmImageInfo.NewInstance(uri, 10000);//will fail when it is no image file |
71 | 75 |
MediaDetailElement.this.getLayoutComposite().getDisplay().asyncExec(()->{ |
72 | 76 |
singleMediaRepresentationPart.setSize((int) imageInfo.getLength()); |
... | ... | |
136 | 140 |
showAdvancedView(); |
137 | 141 |
} |
138 | 142 |
|
143 |
public boolean isShowImage() { |
|
144 |
return isShowImage; |
|
145 |
} |
|
146 |
|
|
147 |
public void setShowImage(boolean isShowImage) { |
|
148 |
this.isShowImage = isShowImage; |
|
149 |
} |
|
150 |
|
|
139 | 151 |
@Override |
140 | 152 |
public void handleEvent(Object eventSource){ |
141 | 153 |
if(eventSource==textUri){ |
... | ... | |
146 | 158 |
uriBuffer=textUri.getText(); |
147 | 159 |
} |
148 | 160 |
else{ |
149 |
new LoadImageJob(uri, LOAD_IMAGE).schedule(); |
|
161 |
if (isShowImage){ |
|
162 |
LoadImageJob job = new LoadImageJob(uri, LOAD_IMAGE); |
|
163 |
job.schedule(); |
|
164 |
} |
|
150 | 165 |
} |
151 | 166 |
} |
152 | 167 |
} |
... | ... | |
232 | 247 |
textUri.parseText(); |
233 | 248 |
} |
234 | 249 |
textUri.getLayoutComposite().layout(); |
235 |
|
|
236 |
new LoadImageJob(singleMediaRepresentationPart.getUri(), LOAD_IMAGE).schedule(); |
|
250 |
if (isShowImage){ |
|
251 |
LoadImageJob job = new LoadImageJob(singleMediaRepresentationPart.getUri(), LOAD_IMAGE); |
|
252 |
job.schedule(); |
|
253 |
} |
|
237 | 254 |
} |
238 | 255 |
} |
239 | 256 |
|
Also available in: Unified diff
ref #9065: derivedUnit wizard should contain media section but without loading the image