| Summary: | SWT exceptions when removing facets with associated property page | ||
|---|---|---|---|
| Product: | [WebTools] WTP Common Tools | Reporter: | Eric Peters <ericdp> |
| Component: | Faceted Project Framework | Assignee: | wst.common <wst.common-inbox> |
| Status: | CLOSED INVALID | QA Contact: | Konstantin Komissarchik <konstantin> |
| Severity: | normal | ||
| Priority: | P1 | ||
| Version: | 3.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Eric Peters
Property pages are never disposed. I will guess that you are seeing this problem because JAX-RS property page is extending LibraryFacetPropertyPage (which is perfectly fine), but you aren't quite familiar with how that property page operates. There are a number of conditions that make it invalid to attempt to edit facet properties. The one you saw is one of these conditions. LibraryFacetPropertyPage handles this case by creating and destroying its contents on the fly. Either the user will see the expected contents or a message indicating the problem. The trick is that if you are overriding performOk method is that you need to check if you are still in a valid context. There are a number of ways to do this, but I would recommend calling getLibraryInstallDelegate() and making sure that the result is not null. The other thing to do is to make sure that you don't assume that your controls will only be created once during page existence. Do not hold the controls you allocate in page object's fields. Rather, register change listeners when you create controls and update data fields from those listeners. Here is a fun scenario to try: 1. Start with a project with JAX-RS facet. 2. Open project properties page. 3. Visit JAX-RS page. 4. Visit facets page, uninstall JAX-RS facet, hit apply. 5. Visit JAX-RS page. 6. Visit facets page, install JAX-RS facet, hit apply. 7. Visit JAX-RS page. 8. Hit ok. Thanks a lot Konstantin, as you suggest the property page itself is not disposed (I never tried the scenario below but does prove your point quite well), but rather it's controls are disposed which is why we were getting the exception. As per your comments will use getLibraryInstallDelegate() to detect if we are in a valid context. |