Version 6 (modified by 17 years ago) (diff) | ,
---|
Create Model Navigator
- Create new view with a normal TreeViewer? (for example)
- Use
AdapterFactoryContentProvider
as content provider andAdapterFactoryLabelProvider
as label provider. It should be something like that:
AdapterFactory adapterFactory = ExhibitionDiagramEditorPlugin .getInstance().getItemProvidersAdapterFactory(); viewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); viewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- 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());
- You can inherit from the content and label provider to customize them for your needs.
- Notice: the viewer will only update the objects that it contains. If you for example omit the top-level node, the viewer will not notice if you add or remove a childnode of the top-level node.
If you want the properties view to listen to selection changes of the viewer do the following:
- The view must implement
ITabbedPropertySheetPageContributor
- The method
getContributorId()
must return the ID that is returned bygetContributorId()
of your XXXDiagramEditor class. - Implement the method
getAdapter
similar to the following:public Object getAdapter(Class type) { if (type == IPropertySheetPage.class) { return new PropertiesBrowserPage(this); } return super.getAdapter(type); }