Errata: Section 2.8 Writing plug-in tests

Tell us what you think about our book and report any errata. Sample chapters are available at http://www.qualityeclipse.com/

(Note: Previous Editions were called "Eclipse: Building Commercial Quality Plugins")

Moderators: Eric Clayberg, Dan Rubel

Errata: Section 2.8 Writing plug-in tests

Postby smithla » Tue Jan 06, 2009 9:17 am

Two small problems in the plug-in test code in section 2.8. of the Book and PDF. Both of these have been fixed it the downloadble examples, but do not yet appear in the errata page.

First, the line below is missing from the import statements.

import org.eclipse.core.runtime.jobs.Job;

Second, the waitForJobs method in the book seems to cause the test to hang

public void waitForJobs() {
while (!Job.getJobManager().isIdle())
delay(1000);
}

The correct method (from the downloaded code) is:

public void waitForJobs() {
while (Job.getJobManager().currentJob() != null)
delay(1000);
}
smithla
 
Posts: 1
Joined: Tue Jan 06, 2009 9:00 am

Re: Errata: Section 2.8 Writing plug-in tests

Postby bgruenba » Tue Jan 06, 2009 12:34 pm

I found this problem myself. It seems that the issue is actually a known issue with Mylyn. There is a thread on dev.eclipse.org on exactly this issue.
http://dev.eclipse.org/mhonarc/lists/my ... 00072.html
regards,
Bruce Gruenbaum
bgruenba
 
Posts: 4
Joined: Tue Jan 06, 2009 12:30 pm

Re: Errata: Section 2.8 Writing plug-in tests

Postby Dan Rubel » Sat Jan 17, 2009 11:56 am

Thanks for spotting this. I have updated the errata page and included a link to the Mylyn discussion
Dan Rubel
Moderator
 
Posts: 27
Joined: Thu Oct 30, 2003 9:13 am

Re: Errata: Section 2.8 Writing plug-in tests

Postby tkubaska » Sat Feb 28, 2009 8:33 am

I noticed the missing import statement also but the

Code: Select all
public void waitForJobs() {
   while(!Job.getJobManager().isIdle())
      delay(1000);
}


does not cause the test to hang for me. The test runs fine. But then I have not installed Mylyn in this Eclipse instance.

Also interesting that (when you don't have the import) selecting Job, right clicking, choosing Source->Add Import puts in the correct import statement.

In spite of Eric's advice to the contrary, I'm still using 3.5M5 on Linux. I haven't noticed problems so far other than the UI for adding the update site which was more of an annoyance than a problem.
tkubaska
 
Posts: 4
Joined: Wed Feb 25, 2009 3:28 pm


Return to Book: Eclipse Plug-Ins (3rd Edition)

Who is online

Users browsing this forum: No registered users and 1 guest