Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » User-Jobs cannot be rescheduled
User-Jobs cannot be rescheduled [message #528319] Tue, 20 April 2010 07:21 Go to next message
Niels Lippke is currently offline Niels LippkeFriend
Messages: 71
Registered: December 2009
Member
Hi,

I face a severe problem with the Jobs API. The code below works in RCP, but
not in RAP. So I guess there's something odd in the RAP implementation.

The snippet blow fills a table as a result of a job execution. If the job is
scheduled the first time everything is fine. If the job is scheduled anew a
JobCanceler is notified which calls the done-Method with a Cancel Status and
the job is not executed.

This is a User job. In the ApplicationWorkbenchWindowAdvisor I set

public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
...
configurer.setShowProgressIndicator( true );
}

to see the ProgressIndicator and I also call job.setUser(true) before
scheduling, what might cause the problem. Because, if I do not set the job
as Userjob, the job handling works the way it should.

Snippet:

public void createPartControl(Composite parent) {
Link l = new Link(parent, SWT.NONE);
l.setText("<a>start</a>");
final TableViewer v = new TableViewer(parent, SWT.BORDER);
v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
true));
v.setLabelProvider(new LabelProvider() {
/** {@inheritDoc} */
@Override
public String getText(Object element) {
return element.toString();
}});
v.setContentProvider(new ArrayContentProvider());
final Job job = new Job("loading") {
/** {@inheritDoc} */
@Override
protected IStatus run(IProgressMonitor monitor) {
elements = new String[100];
for (int i=0;i<100;i++) {
elements[i] = "Element " + i;
try {
Thread.currentThread().sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return Status.OK_STATUS;
}};
job.setUser(true);
job.setPriority(Job.SHORT);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().getSeverity() == Status.CANCEL) {
System.out.println("Cancel????");
return;
}
v.getControl().getDisplay().asyncExec(new Runnable() {

@Override
public void run() {
v.setInput(elements);
}});
}
});
l.addSelectionListener(new SelectionAdapter() {

/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
job.schedule();
}

});
GridLayoutFactory.swtDefaults().generateLayout(parent);
}

Help - I need somebody - Help - not just anybody...

Thanks, Niels
Re: User-Jobs cannot be rescheduled [message #528332 is a reply to message #528319] Tue, 20 April 2010 08:01 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Niels,

maybe you run into this bug:
274806: Job with display.(a)syncExec do not update UI/Table properly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806

Best,
Ivan

On 04/20/2010 10:21 AM, Niels Lippke wrote:
> Hi,
>
> I face a severe problem with the Jobs API. The code below works in
> RCP, but not in RAP. So I guess there's something odd in the RAP
> implementation.
>
> The snippet blow fills a table as a result of a job execution. If the
> job is scheduled the first time everything is fine. If the job is
> scheduled anew a JobCanceler is notified which calls the done-Method
> with a Cancel Status and the job is not executed.
>
> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>
> public void preWindowOpen() {
> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
> ...
> configurer.setShowProgressIndicator( true );
> }
>
> to see the ProgressIndicator and I also call job.setUser(true) before
> scheduling, what might cause the problem. Because, if I do not set the
> job as Userjob, the job handling works the way it should.
>
> Snippet:
>
> public void createPartControl(Composite parent) {
> Link l = new Link(parent, SWT.NONE);
> l.setText("<a>start</a>");
> final TableViewer v = new TableViewer(parent, SWT.BORDER);
> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
> true));
> v.setLabelProvider(new LabelProvider() {
> /** {@inheritDoc} */
> @Override
> public String getText(Object element) {
> return element.toString();
> }});
> v.setContentProvider(new ArrayContentProvider());
> final Job job = new Job("loading") {
> /** {@inheritDoc} */
> @Override
> protected IStatus run(IProgressMonitor monitor) {
> elements = new String[100];
> for (int i=0;i<100;i++) {
> elements[i] = "Element " + i;
> try {
> Thread.currentThread().sleep(10);
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> return Status.OK_STATUS;
> }};
> job.setUser(true);
> job.setPriority(Job.SHORT);
> job.addJobChangeListener(new JobChangeAdapter() {
> @Override
> public void done(IJobChangeEvent event) {
> if (event.getResult().getSeverity() == Status.CANCEL) {
> System.out.println("Cancel????");
> return;
> }
> v.getControl().getDisplay().asyncExec(new Runnable() {
>
> @Override
> public void run() {
> v.setInput(elements);
> }});
> }
> });
> l.addSelectionListener(new SelectionAdapter() {
>
> /** {@inheritDoc} */
> @Override
> public void widgetSelected(SelectionEvent e) {
> job.schedule();
> }
>
> });
> GridLayoutFactory.swtDefaults().generateLayout(parent);
> }
>
> Help - I need somebody - Help - not just anybody...
>
> Thanks, Niels
Re: User-Jobs cannot be rescheduled [message #528346 is a reply to message #528332] Tue, 20 April 2010 08:23 Go to previous messageGo to next message
Niels Lippke is currently offline Niels LippkeFriend
Messages: 71
Registered: December 2009
Member
I don't think so. My UI is updated perfectly.
My problem is, that the job's run()-Method is not called on subsequent
schedules. Adding a UICallback brings nothing.

Regards, Niels

"Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
news:hqjn04$iug$2@build.eclipse.org...
> Hi Niels,
>
> maybe you run into this bug:
> 274806: Job with display.(a)syncExec do not update UI/Table properly
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806
>
> Best,
> Ivan
>
> On 04/20/2010 10:21 AM, Niels Lippke wrote:
>> Hi,
>>
>> I face a severe problem with the Jobs API. The code below works in RCP,
>> but not in RAP. So I guess there's something odd in the RAP
>> implementation.
>>
>> The snippet blow fills a table as a result of a job execution. If the job
>> is scheduled the first time everything is fine. If the job is scheduled
>> anew a JobCanceler is notified which calls the done-Method with a Cancel
>> Status and the job is not executed.
>>
>> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>>
>> public void preWindowOpen() {
>> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>> ...
>> configurer.setShowProgressIndicator( true );
>> }
>>
>> to see the ProgressIndicator and I also call job.setUser(true) before
>> scheduling, what might cause the problem. Because, if I do not set the
>> job as Userjob, the job handling works the way it should.
>>
>> Snippet:
>>
>> public void createPartControl(Composite parent) {
>> Link l = new Link(parent, SWT.NONE);
>> l.setText("<a>start</a>");
>> final TableViewer v = new TableViewer(parent, SWT.BORDER);
>> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
>> true));
>> v.setLabelProvider(new LabelProvider() {
>> /** {@inheritDoc} */
>> @Override
>> public String getText(Object element) {
>> return element.toString();
>> }});
>> v.setContentProvider(new ArrayContentProvider());
>> final Job job = new Job("loading") {
>> /** {@inheritDoc} */
>> @Override
>> protected IStatus run(IProgressMonitor monitor) {
>> elements = new String[100];
>> for (int i=0;i<100;i++) {
>> elements[i] = "Element " + i;
>> try {
>> Thread.currentThread().sleep(10);
>> } catch (InterruptedException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> }
>> return Status.OK_STATUS;
>> }};
>> job.setUser(true);
>> job.setPriority(Job.SHORT);
>> job.addJobChangeListener(new JobChangeAdapter() {
>> @Override
>> public void done(IJobChangeEvent event) {
>> if (event.getResult().getSeverity() == Status.CANCEL) {
>> System.out.println("Cancel????");
>> return;
>> }
>> v.getControl().getDisplay().asyncExec(new Runnable() {
>>
>> @Override
>> public void run() {
>> v.setInput(elements);
>> }});
>> }
>> });
>> l.addSelectionListener(new SelectionAdapter() {
>>
>> /** {@inheritDoc} */
>> @Override
>> public void widgetSelected(SelectionEvent e) {
>> job.schedule();
>> }
>>
>> });
>> GridLayoutFactory.swtDefaults().generateLayout(parent);
>> }
>>
>> Help - I need somebody - Help - not just anybody...
>>
>> Thanks, Niels
Re: User-Jobs cannot be rescheduled [message #528348 is a reply to message #528346] Tue, 20 April 2010 08:27 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Nies,

> Adding a UICallback brings nothing.
you mean that manually activating of the callback before the first job
execution does not solve the problem?

Best,
Ivan

On 04/20/2010 11:23 AM, Niels Lippke wrote:
> I don't think so. My UI is updated perfectly.
> My problem is, that the job's run()-Method is not called on subsequent
> schedules. Adding a UICallback brings nothing.
>
> Regards, Niels
>
> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
> news:hqjn04$iug$2@build.eclipse.org...
>> Hi Niels,
>>
>> maybe you run into this bug:
>> 274806: Job with display.(a)syncExec do not update UI/Table properly
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806
>>
>> Best,
>> Ivan
>>
>> On 04/20/2010 10:21 AM, Niels Lippke wrote:
>>> Hi,
>>>
>>> I face a severe problem with the Jobs API. The code below works in
>>> RCP, but not in RAP. So I guess there's something odd in the RAP
>>> implementation.
>>>
>>> The snippet blow fills a table as a result of a job execution. If
>>> the job is scheduled the first time everything is fine. If the job
>>> is scheduled anew a JobCanceler is notified which calls the
>>> done-Method with a Cancel Status and the job is not executed.
>>>
>>> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>>>
>>> public void preWindowOpen() {
>>> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>>> ...
>>> configurer.setShowProgressIndicator( true );
>>> }
>>>
>>> to see the ProgressIndicator and I also call job.setUser(true)
>>> before scheduling, what might cause the problem. Because, if I do
>>> not set the job as Userjob, the job handling works the way it should.
>>>
>>> Snippet:
>>>
>>> public void createPartControl(Composite parent) {
>>> Link l = new Link(parent, SWT.NONE);
>>> l.setText("<a>start</a>");
>>> final TableViewer v = new TableViewer(parent, SWT.BORDER);
>>> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
>>> true));
>>> v.setLabelProvider(new LabelProvider() {
>>> /** {@inheritDoc} */
>>> @Override
>>> public String getText(Object element) {
>>> return element.toString();
>>> }});
>>> v.setContentProvider(new ArrayContentProvider());
>>> final Job job = new Job("loading") {
>>> /** {@inheritDoc} */
>>> @Override
>>> protected IStatus run(IProgressMonitor monitor) {
>>> elements = new String[100];
>>> for (int i=0;i<100;i++) {
>>> elements[i] = "Element " + i;
>>> try {
>>> Thread.currentThread().sleep(10);
>>> } catch (InterruptedException e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> }
>>> }
>>> return Status.OK_STATUS;
>>> }};
>>> job.setUser(true);
>>> job.setPriority(Job.SHORT);
>>> job.addJobChangeListener(new JobChangeAdapter() {
>>> @Override
>>> public void done(IJobChangeEvent event) {
>>> if (event.getResult().getSeverity() == Status.CANCEL) {
>>> System.out.println("Cancel????");
>>> return;
>>> }
>>> v.getControl().getDisplay().asyncExec(new Runnable() {
>>>
>>> @Override
>>> public void run() {
>>> v.setInput(elements);
>>> }});
>>> }
>>> });
>>> l.addSelectionListener(new SelectionAdapter() {
>>>
>>> /** {@inheritDoc} */
>>> @Override
>>> public void widgetSelected(SelectionEvent e) {
>>> job.schedule();
>>> }
>>>
>>> });
>>> GridLayoutFactory.swtDefaults().generateLayout(parent);
>>> }
>>>
>>> Help - I need somebody - Help - not just anybody...
>>>
>>> Thanks, Niels
>
Re: User-Jobs cannot be rescheduled [message #528349 is a reply to message #528348] Tue, 20 April 2010 08:41 Go to previous messageGo to next message
Niels Lippke is currently offline Niels LippkeFriend
Messages: 71
Registered: December 2009
Member
Yes - I mean No it does not solve the problem.

Regards,
Niels

"Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
news:hqjohv$ob9$1@build.eclipse.org...
> Nies,
>
>> Adding a UICallback brings nothing.
> you mean that manually activating of the callback before the first job
> execution does not solve the problem?
>
> Best,
> Ivan
>
> On 04/20/2010 11:23 AM, Niels Lippke wrote:
>> I don't think so. My UI is updated perfectly.
>> My problem is, that the job's run()-Method is not called on subsequent
>> schedules. Adding a UICallback brings nothing.
>>
>> Regards, Niels
>>
>> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
>> news:hqjn04$iug$2@build.eclipse.org...
>>> Hi Niels,
>>>
>>> maybe you run into this bug:
>>> 274806: Job with display.(a)syncExec do not update UI/Table properly
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806
>>>
>>> Best,
>>> Ivan
>>>
>>> On 04/20/2010 10:21 AM, Niels Lippke wrote:
>>>> Hi,
>>>>
>>>> I face a severe problem with the Jobs API. The code below works in RCP,
>>>> but not in RAP. So I guess there's something odd in the RAP
>>>> implementation.
>>>>
>>>> The snippet blow fills a table as a result of a job execution. If the
>>>> job is scheduled the first time everything is fine. If the job is
>>>> scheduled anew a JobCanceler is notified which calls the done-Method
>>>> with a Cancel Status and the job is not executed.
>>>>
>>>> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>>>>
>>>> public void preWindowOpen() {
>>>> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>>>> ...
>>>> configurer.setShowProgressIndicator( true );
>>>> }
>>>>
>>>> to see the ProgressIndicator and I also call job.setUser(true) before
>>>> scheduling, what might cause the problem. Because, if I do not set the
>>>> job as Userjob, the job handling works the way it should.
>>>>
>>>> Snippet:
>>>>
>>>> public void createPartControl(Composite parent) {
>>>> Link l = new Link(parent, SWT.NONE);
>>>> l.setText("<a>start</a>");
>>>> final TableViewer v = new TableViewer(parent, SWT.BORDER);
>>>> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
>>>> true));
>>>> v.setLabelProvider(new LabelProvider() {
>>>> /** {@inheritDoc} */
>>>> @Override
>>>> public String getText(Object element) {
>>>> return element.toString();
>>>> }});
>>>> v.setContentProvider(new ArrayContentProvider());
>>>> final Job job = new Job("loading") {
>>>> /** {@inheritDoc} */
>>>> @Override
>>>> protected IStatus run(IProgressMonitor monitor) {
>>>> elements = new String[100];
>>>> for (int i=0;i<100;i++) {
>>>> elements[i] = "Element " + i;
>>>> try {
>>>> Thread.currentThread().sleep(10);
>>>> } catch (InterruptedException e) {
>>>> // TODO Auto-generated catch block
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>> return Status.OK_STATUS;
>>>> }};
>>>> job.setUser(true);
>>>> job.setPriority(Job.SHORT);
>>>> job.addJobChangeListener(new JobChangeAdapter() {
>>>> @Override
>>>> public void done(IJobChangeEvent event) {
>>>> if (event.getResult().getSeverity() == Status.CANCEL) {
>>>> System.out.println("Cancel????");
>>>> return;
>>>> }
>>>> v.getControl().getDisplay().asyncExec(new Runnable() {
>>>>
>>>> @Override
>>>> public void run() {
>>>> v.setInput(elements);
>>>> }});
>>>> }
>>>> });
>>>> l.addSelectionListener(new SelectionAdapter() {
>>>>
>>>> /** {@inheritDoc} */
>>>> @Override
>>>> public void widgetSelected(SelectionEvent e) {
>>>> job.schedule();
>>>> }
>>>>
>>>> });
>>>> GridLayoutFactory.swtDefaults().generateLayout(parent);
>>>> }
>>>>
>>>> Help - I need somebody - Help - not just anybody...
>>>>
>>>> Thanks, Niels
>>
Re: User-Jobs cannot be rescheduled [message #528357 is a reply to message #528349] Tue, 20 April 2010 09:05 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
In this case, if your code works in RCP, feel free to open a bugzilla
with the attached snippet to reproduce it.

TIA,
Ivan

On 04/20/2010 11:41 AM, Niels Lippke wrote:
> Yes - I mean No it does not solve the problem.
>
> Regards,
> Niels
>
> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
> news:hqjohv$ob9$1@build.eclipse.org...
>> Nies,
>>
>>> Adding a UICallback brings nothing.
>> you mean that manually activating of the callback before the first
>> job execution does not solve the problem?
>>
>> Best,
>> Ivan
>>
>> On 04/20/2010 11:23 AM, Niels Lippke wrote:
>>> I don't think so. My UI is updated perfectly.
>>> My problem is, that the job's run()-Method is not called on
>>> subsequent schedules. Adding a UICallback brings nothing.
>>>
>>> Regards, Niels
>>>
>>> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
>>> news:hqjn04$iug$2@build.eclipse.org...
>>>> Hi Niels,
>>>>
>>>> maybe you run into this bug:
>>>> 274806: Job with display.(a)syncExec do not update UI/Table properly
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806
>>>>
>>>> Best,
>>>> Ivan
>>>>
>>>> On 04/20/2010 10:21 AM, Niels Lippke wrote:
>>>>> Hi,
>>>>>
>>>>> I face a severe problem with the Jobs API. The code below works in
>>>>> RCP, but not in RAP. So I guess there's something odd in the RAP
>>>>> implementation.
>>>>>
>>>>> The snippet blow fills a table as a result of a job execution. If
>>>>> the job is scheduled the first time everything is fine. If the job
>>>>> is scheduled anew a JobCanceler is notified which calls the
>>>>> done-Method with a Cancel Status and the job is not executed.
>>>>>
>>>>> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>>>>>
>>>>> public void preWindowOpen() {
>>>>> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>>>>> ...
>>>>> configurer.setShowProgressIndicator( true );
>>>>> }
>>>>>
>>>>> to see the ProgressIndicator and I also call job.setUser(true)
>>>>> before scheduling, what might cause the problem. Because, if I do
>>>>> not set the job as Userjob, the job handling works the way it should.
>>>>>
>>>>> Snippet:
>>>>>
>>>>> public void createPartControl(Composite parent) {
>>>>> Link l = new Link(parent, SWT.NONE);
>>>>> l.setText("<a>start</a>");
>>>>> final TableViewer v = new TableViewer(parent, SWT.BORDER);
>>>>> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL,
>>>>> true, true));
>>>>> v.setLabelProvider(new LabelProvider() {
>>>>> /** {@inheritDoc} */
>>>>> @Override
>>>>> public String getText(Object element) {
>>>>> return element.toString();
>>>>> }});
>>>>> v.setContentProvider(new ArrayContentProvider());
>>>>> final Job job = new Job("loading") {
>>>>> /** {@inheritDoc} */
>>>>> @Override
>>>>> protected IStatus run(IProgressMonitor monitor) {
>>>>> elements = new String[100];
>>>>> for (int i=0;i<100;i++) {
>>>>> elements[i] = "Element " + i;
>>>>> try {
>>>>> Thread.currentThread().sleep(10);
>>>>> } catch (InterruptedException e) {
>>>>> // TODO Auto-generated catch block
>>>>> e.printStackTrace();
>>>>> }
>>>>> }
>>>>> return Status.OK_STATUS;
>>>>> }};
>>>>> job.setUser(true);
>>>>> job.setPriority(Job.SHORT);
>>>>> job.addJobChangeListener(new JobChangeAdapter() {
>>>>> @Override
>>>>> public void done(IJobChangeEvent event) {
>>>>> if (event.getResult().getSeverity() == Status.CANCEL) {
>>>>> System.out.println("Cancel????");
>>>>> return;
>>>>> }
>>>>> v.getControl().getDisplay().asyncExec(new Runnable() {
>>>>>
>>>>> @Override
>>>>> public void run() {
>>>>> v.setInput(elements);
>>>>> }});
>>>>> }
>>>>> });
>>>>> l.addSelectionListener(new SelectionAdapter() {
>>>>>
>>>>> /** {@inheritDoc} */
>>>>> @Override
>>>>> public void widgetSelected(SelectionEvent e) {
>>>>> job.schedule();
>>>>> }
>>>>>
>>>>> });
>>>>> GridLayoutFactory.swtDefaults().generateLayout(parent);
>>>>> }
>>>>>
>>>>> Help - I need somebody - Help - not just anybody...
>>>>>
>>>>> Thanks, Niels
>>>
>
Re: User-Jobs cannot be rescheduled [message #528381 is a reply to message #528357] Tue, 20 April 2010 10:18 Go to previous message
Niels Lippke is currently offline Niels LippkeFriend
Messages: 71
Registered: December 2009
Member
Done. Bug #309786

Thanks, Niels

"Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
news:hqjqpn$6gi$1@build.eclipse.org...
> In this case, if your code works in RCP, feel free to open a bugzilla with
> the attached snippet to reproduce it.
>
> TIA,
> Ivan
>
> On 04/20/2010 11:41 AM, Niels Lippke wrote:
>> Yes - I mean No it does not solve the problem.
>>
>> Regards,
>> Niels
>>
>> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
>> news:hqjohv$ob9$1@build.eclipse.org...
>>> Nies,
>>>
>>>> Adding a UICallback brings nothing.
>>> you mean that manually activating of the callback before the first job
>>> execution does not solve the problem?
>>>
>>> Best,
>>> Ivan
>>>
>>> On 04/20/2010 11:23 AM, Niels Lippke wrote:
>>>> I don't think so. My UI is updated perfectly.
>>>> My problem is, that the job's run()-Method is not called on subsequent
>>>> schedules. Adding a UICallback brings nothing.
>>>>
>>>> Regards, Niels
>>>>
>>>> "Ivan Furnadjiev" <ivan@eclipsesource.com> schrieb im Newsbeitrag
>>>> news:hqjn04$iug$2@build.eclipse.org...
>>>>> Hi Niels,
>>>>>
>>>>> maybe you run into this bug:
>>>>> 274806: Job with display.(a)syncExec do not update UI/Table properly
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274806
>>>>>
>>>>> Best,
>>>>> Ivan
>>>>>
>>>>> On 04/20/2010 10:21 AM, Niels Lippke wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I face a severe problem with the Jobs API. The code below works in
>>>>>> RCP, but not in RAP. So I guess there's something odd in the RAP
>>>>>> implementation.
>>>>>>
>>>>>> The snippet blow fills a table as a result of a job execution. If the
>>>>>> job is scheduled the first time everything is fine. If the job is
>>>>>> scheduled anew a JobCanceler is notified which calls the done-Method
>>>>>> with a Cancel Status and the job is not executed.
>>>>>>
>>>>>> This is a User job. In the ApplicationWorkbenchWindowAdvisor I set
>>>>>>
>>>>>> public void preWindowOpen() {
>>>>>> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>>>>>> ...
>>>>>> configurer.setShowProgressIndicator( true );
>>>>>> }
>>>>>>
>>>>>> to see the ProgressIndicator and I also call job.setUser(true) before
>>>>>> scheduling, what might cause the problem. Because, if I do not set
>>>>>> the job as Userjob, the job handling works the way it should.
>>>>>>
>>>>>> Snippet:
>>>>>>
>>>>>> public void createPartControl(Composite parent) {
>>>>>> Link l = new Link(parent, SWT.NONE);
>>>>>> l.setText("<a>start</a>");
>>>>>> final TableViewer v = new TableViewer(parent, SWT.BORDER);
>>>>>> v.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
>>>>>> true));
>>>>>> v.setLabelProvider(new LabelProvider() {
>>>>>> /** {@inheritDoc} */
>>>>>> @Override
>>>>>> public String getText(Object element) {
>>>>>> return element.toString();
>>>>>> }});
>>>>>> v.setContentProvider(new ArrayContentProvider());
>>>>>> final Job job = new Job("loading") {
>>>>>> /** {@inheritDoc} */
>>>>>> @Override
>>>>>> protected IStatus run(IProgressMonitor monitor) {
>>>>>> elements = new String[100];
>>>>>> for (int i=0;i<100;i++) {
>>>>>> elements[i] = "Element " + i;
>>>>>> try {
>>>>>> Thread.currentThread().sleep(10);
>>>>>> } catch (InterruptedException e) {
>>>>>> // TODO Auto-generated catch block
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> }
>>>>>> return Status.OK_STATUS;
>>>>>> }};
>>>>>> job.setUser(true);
>>>>>> job.setPriority(Job.SHORT);
>>>>>> job.addJobChangeListener(new JobChangeAdapter() {
>>>>>> @Override
>>>>>> public void done(IJobChangeEvent event) {
>>>>>> if (event.getResult().getSeverity() == Status.CANCEL) {
>>>>>> System.out.println("Cancel????");
>>>>>> return;
>>>>>> }
>>>>>> v.getControl().getDisplay().asyncExec(new Runnable() {
>>>>>>
>>>>>> @Override
>>>>>> public void run() {
>>>>>> v.setInput(elements);
>>>>>> }});
>>>>>> }
>>>>>> });
>>>>>> l.addSelectionListener(new SelectionAdapter() {
>>>>>>
>>>>>> /** {@inheritDoc} */
>>>>>> @Override
>>>>>> public void widgetSelected(SelectionEvent e) {
>>>>>> job.schedule();
>>>>>> }
>>>>>>
>>>>>> });
>>>>>> GridLayoutFactory.swtDefaults().generateLayout(parent);
>>>>>> }
>>>>>>
>>>>>> Help - I need somebody - Help - not just anybody...
>>>>>>
>>>>>> Thanks, Niels
>>>>
>>
Previous Topic:transparency ExpandedComposite, Composite
Next Topic:Font size appearance in RAP not alike to RCP
Goto Forum:
  


Current Time: Fri Apr 19 16:22:15 GMT 2024

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

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

Back to the top