| Summary: | XtextEditor IAdaptable.getAdapter() is not precise enough | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Balazs Varnai <bvarnai> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
A patch is welcome. If you have multiple parts, and you don't want to have the 'common' outline page returned you would have to subclass and override XtextEditor.getAdapter() anyway, don't you? Please reopen and explain your scenario in more detail if I missed something. |
Build Identifier: I20110613-1736 IAdaptable implementation in org.eclipse.xtext.ui.editor.XtextEditor should never return something that is not instance of OutlinePage. Check the contract of IAdaptable.getAdapter(). Code sample as in 2.1: public Object getAdapter(Class adapter) { if (IContentOutlinePage.class.isAssignableFrom(adapter)) { return getContentOutlinePage(); } return super.getAdapter(adapter); } In case of multiple parts implementing IContentOutlinePage, actions could fail due to the misleading return of adapt. My suggestion: public Object getAdapter(Class adapter) { if (org.eclipse.xtext.ui.editor.outline.impl.OutlinePage.class.isAssignableFrom(adapter)) { return getContentOutlinePage(); } return super.getAdapter(adapter); } Reproducible: Always Steps to Reproduce: Integration issue, check code.