A presentation by Eric Moffatt , Remy Suen [IBM], Paul Webster [IBM Canada] on common bugs they found in Eclipse code when run on pure 4.x.
- Aspects to investigate:
- usage patterns
- command patterns
- part management
- interaction with framework
- Commands
- Abstraction of some behaviour
- Not visual
- Not an implementation
- Usage:
- Declaratively via extension
- Programatically by executing Handler service
- Do not use Command.setHandler() - doesn't work
- Do not use Command.executeWithChecks() - sometimes won't work
- Handlers
- Should not carry state
- Get it using HandlerUtil, Command, or framework
- Parts
- Access a service locally if possible, i.e. getSite().getService(). It will scope and cleanup.
- Parent composite assumptions
- Never assume anything about a Composite that is given to you (e.g., the layout, styles, etc.)
- Layout calls might not happen when you think
- Shouldn't set layout on it either if you're not sure it doesn't have any children but you because siblings may not render if they use a different layout.
- E4 is more flexible, so parts can show up anywhere
- Keep parts isolated from one another.
- Caching of values: Part's shell can change in 4.x when part is de/reattached, so don't cache it
- setFocus() needs to be implemented, don't leave it blank. Set focus on a control in the part. Always called from UI thread.
- Avoid downcasting to get implementation API, it won't be there in 4.x.
- Preferences will continue to work through workbench or Equinox API.
- Avoid Workbench.getProgressService().
- SWT containment honored in 4.x, "Big Lie" in 3.x was that every view and toolbar was actually parented by shell. Do not cache Shell.
We should build a 4.x product and test installing our 3.x features in it. Compatibility layer should make them work but would point out such bugs.
No comments:
Post a Comment