Previous Page
Next Page

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.


Previous Page
Next Page