|
Lines 230-238
Link Here
|
| 230 |
* selected a file, yet. Otherwise, a upload is triggered on the Browser side. |
230 |
* selected a file, yet. Otherwise, a upload is triggered on the Browser side. |
| 231 |
* This method returns, if the upload has finished. |
231 |
* This method returns, if the upload has finished. |
| 232 |
*/ |
232 |
*/ |
| 233 |
public void performUpload() { |
233 |
public boolean performUpload() { |
| 234 |
checkWidget(); |
234 |
checkWidget(); |
| 235 |
|
235 |
|
|
|
236 |
boolean uploadPerformed = false; |
| 236 |
// Always check if user selected a file because otherwise the UploadWidget itself doesn't trigger a POST and therefore, the |
237 |
// Always check if user selected a file because otherwise the UploadWidget itself doesn't trigger a POST and therefore, the |
| 237 |
// subsequent loop never terminates. |
238 |
// subsequent loop never terminates. |
| 238 |
if (getPath() != null && !"".equals( getPath() )) { |
239 |
if (getPath() != null && !"".equals( getPath() )) { |
|
Lines 251-256
Link Here
|
| 251 |
getDisplay().sleep(); |
252 |
getDisplay().sleep(); |
| 252 |
} |
253 |
} |
| 253 |
} |
254 |
} |
|
|
255 |
uploadPerformed = !uploadInProgresses[ 0 ]; |
| 254 |
} finally { |
256 |
} finally { |
| 255 |
uploadInProgresses[ 0 ] = false; |
257 |
uploadInProgresses[ 0 ] = false; |
| 256 |
performUpload = false; |
258 |
performUpload = false; |
|
Lines 259-264
Link Here
|
| 259 |
} |
261 |
} |
| 260 |
|
262 |
|
| 261 |
} |
263 |
} |
|
|
264 |
return uploadPerformed; |
| 262 |
} |
265 |
} |
| 263 |
|
266 |
|
| 264 |
public Object getAdapter( final Class adapter ) { |
267 |
public Object getAdapter( final Class adapter ) { |
|
Lines 494-503
Link Here
|
| 494 |
/** |
497 |
/** |
| 495 |
* After uploading has finished this method returns the uploaded file |
498 |
* After uploading has finished this method returns the uploaded file |
| 496 |
* and all available meta data, as file name, content type, etc. |
499 |
* and all available meta data, as file name, content type, etc. |
|
|
500 |
* @throws SWTException SWT.ERROR_WIDGET_DISPOSED if widget is disposed. |
| 497 |
*/ |
501 |
*/ |
| 498 |
public UploadItem getUploadItem() { |
502 |
public UploadItem getUploadItem() { |
| 499 |
checkWidget(); |
503 |
checkWidget(); |
| 500 |
|
504 |
|
|
|
505 |
// TODO: [sr] remove if implemented in Widget#checkWidget() |
| 506 |
if (isDisposed()) { |
| 507 |
SWT.error( SWT.ERROR_WIDGET_DISPOSED ); |
| 508 |
} |
| 509 |
|
| 501 |
final FileUploadStorage storage = FileUploadStorage.getInstance(); |
510 |
final FileUploadStorage storage = FileUploadStorage.getInstance(); |
| 502 |
final FileUploadStorageItem uploadedFile = storage.getUploadStorageItem( getWidgetId() ); |
511 |
final FileUploadStorageItem uploadedFile = storage.getUploadStorageItem( getWidgetId() ); |
| 503 |
final UploadItem uploadItem = new UploadItem( uploadedFile.getFileInputStream(), |
512 |
final UploadItem uploadItem = new UploadItem( uploadedFile.getFileInputStream(), |