singleMediaRepresentationPart.getMediaRepresentation().setSuffix(imageInfo.getSuffix());
}
disposeImage();
- element_image = formFactory.createImageElement(parentFormElement, uri, style);
- StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- try {
- element_image.initImageUri(uri);
- } catch (IOException | HttpException e) {
- exception(e);
+ if (!parentFormElement.getLayoutComposite().isDisposed()) {
+ element_image = formFactory.createImageElement(parentFormElement, uri, style);
+ StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
+ try {
+ element_image.initImageUri(uri);
+ } catch (IOException | HttpException e) {
+ exception(e);
+ }
+ element_image.loadImage();
+ disposeErrorLabel();
}
- element_image.loadImage();
- disposeErrorLabel();
});
} catch (Exception e){
exception(e);
}
private void exception(Exception e){
- getLayoutComposite().getDisplay().asyncExec(()->{
- String exceptionString;
- if(e.getCause()!=null && e.getCause().getClass().equals(ImageReadException.class)){
- disposeErrorLabel();
- exceptionString = Messages.MediaDetailElement_NO_PREVIEW;
- }
- else{
- disposeErrorLabel();
- exceptionString = Messages.MediaDetailElement_NO_FILE_FOUND;
- }
- disposeImage();
- if(lblNoImage==null){
- lblNoImage = formFactory.createLabel(getLayoutComposite(), exceptionString);
- lblNoImage.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- lblNoImage.setAlignment(SWT.CENTER);
- }
- StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- });
+ if(!getLayoutComposite().isDisposed()){
+ getLayoutComposite().getDisplay().asyncExec(()->{
+ String exceptionString;
+ if(e.getCause()!=null && e.getCause().getClass().equals(ImageReadException.class)){
+ disposeErrorLabel();
+ exceptionString = Messages.MediaDetailElement_NO_PREVIEW;
+ }
+ else{
+ disposeErrorLabel();
+ exceptionString = Messages.MediaDetailElement_NO_FILE_FOUND;
+ }
+ disposeImage();
+ if(lblNoImage==null){
+ lblNoImage = formFactory.createLabel(getLayoutComposite(), exceptionString);
+ lblNoImage.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ lblNoImage.setAlignment(SWT.CENTER);
+ }
+ StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
+ });
+ }
}
private void disposeImage(){