on Oct 4th, 2010Chapter 4 errata

Page 52 — The snippet of Application code incorrectly shows the old Eclipse application run() method. The best practice for defining applications is now to implement IApplication which requires a start() and stop() methods as shown below.

public class Application implements IApplication {
	public Object start(IApplicationContext context) {
		Display display = PlatformUI.createDisplay();
		try {
			int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
			if (returnCode == PlatformUI.RETURN_RESTART) {
				return IApplication.EXIT_RESTART;
			}
			return IApplication.EXIT_OK;
		} finally {
			display.dispose();
		}
	}

	public void stop() {
		if (!PlatformUI.isWorkbenchRunning())
			return;
		final IWorkbench workbench = PlatformUI.getWorkbench();
		final Display display = workbench.getDisplay();
		display.syncExec(new Runnable() {
			public void run() {
				if (!display.isDisposed())
					workbench.close();
			}
		});
	}
}

Page 60 — In the description of how to get to the launch configurations (section 4.3.2) the menu path should be Run > Run Configurations… and Run > Debug Configurations…. ¬†Similarly, Figure 4-12 shows an outdated view of the Run menu.

3 Responses to “Chapter 4 errata”

  1. tlonnion 08 Oct 2010 at 12:44 am

    There is a minor error in section “4.3.2 Launch Configurations.” The page says you can use “Run > Run… or Run > Debug…” but I think it is supposed to say: “Run > Run Configurations… or Run > Debug Configurations…” Executing one of these menu items then brings up Figure 4-11 as shown in the book. I’m using the Helios release of Eclipse instead of Galileo, but I’m pretty sure this correction is accurate for both releases.

  2. Jeff McAfferon 08 Oct 2010 at 8:47 am

    Indeed. I updated the errata text accordingly. Thanks

  3. MeAndMyselfon 14 Jan 2012 at 8:01 am

    Hello,

    Also, there is a small error in section “5.4.2.1 Adding the IWorkbenchAdapters”, page 76. The name of the class AdapterFactory i think it should be HyperbolaAdapterFactory (public class AdapterFactory… –> public class HyperbolaAdapterFactory).

Comments RSS

Leave a Reply