|
Re: Loader/ProgressBar [message #102234 is a reply to message #102155] |
Wed, 13 August 2008 07:55 |
Eclipse User |
|
|
|
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 #105326 is a reply to message #104963] |
Tue, 16 September 2008 19:53 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03060 seconds