Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Loader/ProgressBar
Loader/ProgressBar [message #102155] Tue, 12 August 2008 12:09 Go to next message
George Rus is currently offline George RusFriend
Messages: 14
Registered: July 2009
Junior Member
Hello!

I have implemented in my application some operations that take a while.

I'm wondering in an implementation of a kind of loader, a small dialog
with a kind of progressBar that will show the progress of the operation.

Thanks!
Re: Loader/ProgressBar [message #102234 is a reply to message #102155] Wed, 13 August 2008 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi George,

George wrote:
> I have implemented in my application some operations that take a while.
>
> I'm wondering in an implementation of a kind of loader, a small dialog
> with a kind of progressBar that will show the progress of the operation.

Have a look at the JFace ProgressMonitorDialog, it displays the progress
of a long-running operation. You have to wrap your operation in an
IRunnableWithProgress and pass it to the run method of the dialog.

HTH, Ralf
Re: Loader/ProgressBar [message #104913 is a reply to message #102234] Mon, 15 September 2008 15:08 Go to previous messageGo to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Hi, can you give me a little example.
I want to send a mail via RAP and while sending i want to display a
ProgressMonitorDialog.

Roland


Ralf Sternberg schrieb:
> Hi George,
>
> George wrote:
>> I have implemented in my application some operations that take a while.
>>
>> I'm wondering in an implementation of a kind of loader, a small dialog
>> with a kind of progressBar that will show the progress of the operation.
>
> Have a look at the JFace ProgressMonitorDialog, it displays the progress
> of a long-running operation. You have to wrap your operation in an
> IRunnableWithProgress and pass it to the run method of the dialog.
>
> HTH, Ralf
Re: Loader/ProgressBar [message #104921 is a reply to message #104913] Mon, 15 September 2008 15:53 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
Hi,

take a look at the Jobs API [1].

Greets
Benny

[1] http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html

Roland Siebert wrote:
> Hi, can you give me a little example.
> I want to send a mail via RAP and while sending i want to display a
> ProgressMonitorDialog.
>
> Roland
>
>
> Ralf Sternberg schrieb:
>> Hi George,
>>
>> George wrote:
>>> I have implemented in my application some operations that take a while.
>>>
>>> I'm wondering in an implementation of a kind of loader, a small
>>> dialog with a kind of progressBar that will show the progress of the
>>> operation.
>>
>> Have a look at the JFace ProgressMonitorDialog, it displays the
>> progress of a long-running operation. You have to wrap your operation
>> in an IRunnableWithProgress and pass it to the run method of the dialog.
>>
>> HTH, Ralf
Re: Loader/ProgressBar [message #104963 is a reply to message #104921] Tue, 16 September 2008 10:01 Go to previous messageGo to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Thanks.
But why I'm getting an NullPointerException???

public class Application implements IEntryPoint {

public int createUI() {
final Display display = new Display();
final Shell container = new Shell(display);

final MultiPartEmail email = new MultiPartEmail();
final EmailAttachment logFile = new EmailAttachment();
logFile.setPath("C:\\test.log");
logFile.setDisposition(EmailAttachment.ATTACHMENT);
logFile.setDescription("Log-File");

final Job job = new Job("Long Running Job") {
protected IStatus run(IProgressMonitor monitor) {
try {
email.setHostName("smtp.googlemail.com");
email.setSmtpPort(587);
email.setTLS(true);
email.addTo("foo@googlemail.com");
email.setFrom("foo@googlemail.com");
email.setSubject("test-mail");
email.setMsg("If you read this, your mail-configuration works fine!");
email.setAuthentication("foo", "foo");
email.attach(logFile);
email.send();
return Status.OK_STATUS;
} catch (EmailException e) {
e.printStackTrace();
}
return Status.OK_STATUS;
}
};

job.schedule();

job.addJobChangeListener(new IJobChangeListener() {
public void aboutToRun(IJobChangeEvent event) {
System.out.println("aboutToRun");
}

public void awake(IJobChangeEvent event) {
System.out.println("awake");
}

public void done(IJobChangeEvent event) {
System.out.println("done");
}

public void running(IJobChangeEvent event) {
System.out.println("running");
}

public void scheduled(IJobChangeEvent event) {
System.out.println("scheduled");
}

public void sleeping(IJobChangeEvent event) {
System.out.println("sleeping");
}
});

container.open();

while (!container.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return 0;
}


!ENTRY org.eclipse.rap.ui.workbench 4 2 2008-09-16 11:53:16.843
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.rap.ui.workbench".
!STACK 0
java.lang.NullPointerException
at
org.eclipse.ui.internal.progress.ProgressInfoItem.init(Progr essInfoItem.java:163)
at
org.eclipse.ui.internal.progress.ProgressManager$ProgressMan agerProvider.getInstance(ProgressManager.java:73)
at
org.eclipse.ui.internal.progress.ProgressManager.getInstance (ProgressManager.java:151)
at
org.eclipse.ui.internal.progress.JobManagerAdapter$3.run(Job ManagerAdapter.java:169)
at
org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
at
org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
at
org.eclipse.ui.internal.progress.JobManagerAdapter.findProgr essManager(JobManagerAdapter.java:167)
at
org.eclipse.ui.internal.progress.JobManagerAdapter.scheduled (JobManagerAdapter.java:148)
at
org.eclipse.core.internal.jobs.JobListeners$5.notify(JobList eners.java:49)
at
org.eclipse.core.internal.jobs.JobListeners.doNotify(JobList eners.java:96)
at
org.eclipse.core.internal.jobs.JobListeners.scheduled(JobLis teners.java:162)
at org.eclipse.core.internal.jobs.JobManager.schedule(JobManage r.java:976)
at
org.eclipse.core.internal.jobs.InternalJob.schedule(Internal Job.java:376)
at org.eclipse.core.runtime.jobs.Job.schedule(Job.java:435)
at test.Application.createUI(Application.java:55)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
at java.lang.Thread.run(Unknown Source)
aboutToRun
running
done


}Benjamin Muskalla schrieb:
> Hi,
>
> take a look at the Jobs API [1].
>
> Greets
> Benny
>
> [1] http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html
Re: Loader/ProgressBar [message #105326 is a reply to message #104963] Tue, 16 September 2008 19:53 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Roland,

you are launching with org.eclipse.rap.ui.workbench but do not
actually start the workbench (PlatformUI#createAndRunWorkbench).
This might cause the NPE.

From looking at the code (while (!container.isDisposed())...), it
seems that you are using RWT standalone. In this case you would need
to provide an IProgressMonitor implementation and/or use one that
comes with JFace.

This article might give you some directions:
http://www.ibm.com/developerworks/library/os-ecgui2/

HTH
Rüdiger

Roland Siebert wrote:
> Thanks.
> But why I'm getting an NullPointerException???
>
> public class Application implements IEntryPoint {
>
> public int createUI() {
> final Display display = new Display();
> final Shell container = new Shell(display);
>
> final MultiPartEmail email = new MultiPartEmail();
> final EmailAttachment logFile = new EmailAttachment();
> logFile.setPath("C:\\test.log");
> logFile.setDisposition(EmailAttachment.ATTACHMENT);
> logFile.setDescription("Log-File");
>
> final Job job = new Job("Long Running Job") {
> protected IStatus run(IProgressMonitor monitor) {
> try {
> email.setHostName("smtp.googlemail.com");
> email.setSmtpPort(587);
> email.setTLS(true);
> email.addTo("foo@googlemail.com");
> email.setFrom("foo@googlemail.com");
> email.setSubject("test-mail");
> email.setMsg("If you read this, your
> mail-configuration works fine!");
> email.setAuthentication("foo", "foo");
> email.attach(logFile);
> email.send();
> return Status.OK_STATUS;
> } catch (EmailException e) {
> e.printStackTrace();
> }
> return Status.OK_STATUS;
> }
> };
>
> job.schedule();
>
> job.addJobChangeListener(new IJobChangeListener() {
> public void aboutToRun(IJobChangeEvent event) {
> System.out.println("aboutToRun");
> }
>
> public void awake(IJobChangeEvent event) {
> System.out.println("awake");
> }
>
> public void done(IJobChangeEvent event) {
> System.out.println("done");
> }
>
> public void running(IJobChangeEvent event) {
> System.out.println("running");
> }
>
> public void scheduled(IJobChangeEvent event) {
> System.out.println("scheduled");
> }
>
> public void sleeping(IJobChangeEvent event) {
> System.out.println("sleeping");
> }
> });
>
> container.open();
>
> while (!container.isDisposed()) {
> if (!display.readAndDispatch()) {
> display.sleep();
> }
> }
> return 0;
> }
>
>
> !ENTRY org.eclipse.rap.ui.workbench 4 2 2008-09-16 11:53:16.843
> !MESSAGE Problems occurred when invoking code from plug-in:
> "org.eclipse.rap.ui.workbench".
> !STACK 0
> java.lang.NullPointerException
> at
> org.eclipse.ui.internal.progress.ProgressInfoItem.init(Progr essInfoItem.java:163)
>
> at
> org.eclipse.ui.internal.progress.ProgressManager$ProgressMan agerProvider.getInstance(ProgressManager.java:73)
>
> at
> org.eclipse.ui.internal.progress.ProgressManager.getInstance (ProgressManager.java:151)
>
> at
> org.eclipse.ui.internal.progress.JobManagerAdapter$3.run(Job ManagerAdapter.java:169)
>
> at
> org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
>
> at
> org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
>
> at
> org.eclipse.ui.internal.progress.JobManagerAdapter.findProgr essManager(JobManagerAdapter.java:167)
>
> at
> org.eclipse.ui.internal.progress.JobManagerAdapter.scheduled (JobManagerAdapter.java:148)
>
> at
> org.eclipse.core.internal.jobs.JobListeners$5.notify(JobList eners.java:49)
> at
> org.eclipse.core.internal.jobs.JobListeners.doNotify(JobList eners.java:96)
> at
> org.eclipse.core.internal.jobs.JobListeners.scheduled(JobLis teners.java:162)
>
> at
> org.eclipse.core.internal.jobs.JobManager.schedule(JobManage r.java:976)
> at
> org.eclipse.core.internal.jobs.InternalJob.schedule(Internal Job.java:376)
> at org.eclipse.core.runtime.jobs.Job.schedule(Job.java:435)
> at test.Application.createUI(Application.java:55)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
>
> at java.lang.Thread.run(Unknown Source)
> aboutToRun
> running
> done
>
>
> }Benjamin Muskalla schrieb:
>> Hi,
>>
>> take a look at the Jobs API [1].
>>
>> Greets
>> Benny
>>
>> [1] http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html
Previous Topic:production RAP applications
Next Topic:Progress Monitoring
Goto Forum:
  


Current Time: Fri Apr 26 19:19:18 GMT 2024

Powered by FUDForum. Page generated in 0.03060 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top