Section 8.6. Linking the Editor


8.6. Linking the Editor

The selection in the active editor can be linked to the views that surround it in a technique similar to linking view selections (see Section 7.4, Linking the View, on page 305). In addition, the editor can provide content for the Outline view by implementing the getAdapter(Class) method something like this (see Section 7.4.2, Adaptable objects, on page 306 for more about adapters):

private PropertiesOutlinePage outlinePage; public Object getAdapter(Class adapter) {    if (adapter.equals(IContentOutlinePage.class)) {       if (outlinePage == null)          outlinePage = new PropertiesOutlinePage();       return outlinePage;   }   return super.getAdapter(adapter); } 


The PropertiesOutlinePage class implements IContentOutlinePage, typically by extending ContentOutlinePage and implementing a handful of methods. These methods are similar to the methods discussed earlier in this chapter and in the previous chapter; thus, they are not covered in detail here.



Eclipse(c) Building Commercial-Quality Plug-ins
Eclipse: Building Commercial-Quality Plug-ins (2nd Edition)
ISBN: 032142672X
EAN: 2147483647
Year: 2004
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net