Upload file code deprecation [message #938260] |
Tue, 09 October 2012 14:10  |
Eclipse User |
|
|
|
Hi,
We bought a production from a vendor many years ago, who used eclipse to develop the application. But the vendor is no longer support this application. Right now we have to make some changes to the applications, although we don't have any expertise in eclipse/java. Anyway, we imported the application to eclipse workspace (we are using
Eclipse for RCP and RAP developers; version Indigo Service Release 2, Build id 20120216-1857). We were able to compile the application (although we do see some warning messages) and created a war file and deployed it to tomcat on linux server. And we were able to upload a file. BUT the name of the upload file was changed to 'upload.1508403605239944151.tmp' instead of keeping the original file name (i.e. tran1009.xml). This caused problem to the application to continue processing. We realize/understand "org.eclipse.rwt.widgets.Upload" and "org.eclipse.rwt.widgets.UploadItem" are obsolete or no longer valid in new eclipse. We are wondering if it's still possible we can use the old code (upload function) by including some some lib/jar/patch... So we don't have to change the program if we could avoid. OR if we have to change our programs, would you please give us some guideline or sample to convert the old upload codes to new upload function.
Thank you so much for your help!
Lily
=======
private void createUploadWidget1(Composite parent) {
final Upload upload = new Upload(parent, SWT.BORDER, SWT.NONE);
upload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Label l = new Label(parent, SWT.WRAP);
l.setText("");
ClassLoader classLoader = getClass().getClassLoader();
Image buttonImage = Graphics.getImage(BUTTON_IMAGE_PATH, classLoader);
final Button btnStartUpload = new Button(parent, SWT.PUSH);
btnStartUpload.setText("Upload selected file");
btnStartUpload.setImage(buttonImage);
btnStartUpload.setEnabled(false);
btnStartUpload.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
upload.performUpload();
handleUploadFinished(upload);
}
});
upload.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
if (!"".equals(upload.getPath())) {
btnStartUpload.setEnabled(true);
}
}
});
}
|
|
|
Re: Upload file code deprecation [message #938283 is a reply to message #938260] |
Tue, 09 October 2012 14:33   |
Eclipse User |
|
|
|
Hi,
this has been fixed with bug:
358248: File upload handler does not return actual selected filename
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358248
the file name is preserved when uploading. You should use the FileUpload
for RAP 1.5.
Best,
Ivan
On 10/9/2012 9:10 PM, Lily Ye wrote:
> Hi,
> We bought a production from a vendor many years ago, who used eclipse
> to develop the application. But the vendor is no longer support this
> application. Right now we have to make some changes to the
> applications, although we don't have any expertise in eclipse/java.
> Anyway, we imported the application to eclipse workspace (we are using
> Eclipse for RCP and RAP developers; version Indigo Service Release 2,
> Build id 20120216-1857). We were able to compile the application
> (although we do see some warning messages) and created a war file and
> deployed it to tomcat on linux server. And we were able to upload a
> file. BUT the name of the upload file was changed to
> 'upload.1508403605239944151.tmp' instead of keeping the original file
> name (i.e. tran1009.xml). This caused problem to the application to
> continue processing. We realize/understand
> "org.eclipse.rwt.widgets.Upload" and
> "org.eclipse.rwt.widgets.UploadItem" are obsolete or no longer valid
> in new eclipse. We are wondering if it's still possible we can use the
> old code (upload function) by including some some lib/jar/patch... So
> we don't have to change the program if we could avoid. OR if we have
> to change our programs, would you please give us some guideline or
> sample to convert the old upload codes to new upload function.
> Thank you so much for your help!
> Lily
> ======= private void createUploadWidget1(Composite parent) {
>
> final Upload upload = new Upload(parent, SWT.BORDER, SWT.NONE);
> upload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
> true));
>
> Label l = new Label(parent, SWT.WRAP);
> l.setText("");
>
> ClassLoader classLoader = getClass().getClassLoader();
> Image buttonImage = Graphics.getImage(BUTTON_IMAGE_PATH,
> classLoader);
>
> final Button btnStartUpload = new Button(parent, SWT.PUSH);
> btnStartUpload.setText("Upload selected file");
> btnStartUpload.setImage(buttonImage);
> btnStartUpload.setEnabled(false);
> btnStartUpload.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> upload.performUpload();
> handleUploadFinished(upload);
> }
> });
>
> upload.addModifyListener(new ModifyListener() {
> public void modifyText(ModifyEvent event) {
> if (!"".equals(upload.getPath())) {
> btnStartUpload.setEnabled(true);
> }
> }
>
> });
>
> }
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
|
Re: Upload file code deprecation [message #960117 is a reply to message #959711] |
Sat, 27 October 2012 03:21  |
Eclipse User |
|
|
|
Hi,
the source code of the old deprecated Upload widget is still available
in the read-only RAP CVS repository
dev.eclipse.org:/cvsroot/rt/org.eclipse.rap/sandbox/org.eclipse.rwt.widgets.upload
You could try to fix the problem yourself. I'm not sure if this old
widget is still working with RAP 1.5 - probably not. I strongly
recommend to use FileUpload bundles from the incubator instead.
[1]
Best,
Ivan
On 10/27/2012 2:20 AM, Lily Ye wrote:
> Hi Ivan,
>
> Because of lack of our resources to make changes in the existing java
> programs for "fileupload" in JUNO/RAP1.5, we are wondering if we still
> can use "org.eclipse.rwt.widgets.Upload" and "import
> org.eclipse.rwt.widgets.UploadItem" in any previous version of eclipse
> (the latest is better) which we still can download from eclipse
> website, so we can work around this upload problem and move forward.
> Thanks for your advise,
> Lily
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.04321 seconds