wiki:ModelNavigator

Version 2 (modified by anonymous, 17 years ago) (diff)

--

Create Model Navigator

[gmf <back]

  1. Create new view with a normal TreeViewer? (for example)
  2. Use AdapterFactoryContentProvider as content provider and AdapterFactoryLabelProvider as label provider. It should be something like that:
    AdapterFactory adapterFactory = ExhibitionDiagramEditorPlugin
            .getInstance().getItemProvidersAdapterFactory();
    viewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
    viewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    
  3. Set the input of the viewer like that: (Maybe there is a better way, but I didn't found it yet...)
    IEditorPart edp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    viewer.setInput(((DiagramDocumentEditor)edp).getEditingDomain().getResourceSet());
    
  4. You can inherit from the content and label provider to customize them for your needs.