use of org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewContextMenuProvider in project webtools.sourceediting by eclipse.
the class ADTContentOutlinePage method createControl.
public void createControl(Composite parent) {
super.createControl(parent);
getTreeViewer().setContentProvider(contentProvider);
getTreeViewer().setLabelProvider(labelProvider);
getTreeViewer().setInput(model);
getTreeViewer().addSelectionChangedListener(this);
// $NON-NLS-1$
MenuManager menuManager = new MenuManager("#popup");
menuManager.setRemoveAllWhenShown(true);
Menu menu = menuManager.createContextMenu(getTreeViewer().getControl());
getTreeViewer().getControl().setMenu(menu);
setSelectionManager(editor.getSelectionManager());
// Create menu...for now reuse graph's. Note edit part viewer = null
DesignViewContextMenuProvider menuProvider = new DesignViewContextMenuProvider(editor, null, editor.getSelectionManager());
menuManager.addMenuListener(menuProvider);
// $NON-NLS-1$
getSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.outline", menuManager, editor.getSelectionManager());
// enable popupMenus extension
// getSite().registerContextMenu("org.eclipse.wst.xsdeditor.ui.popup.outline",
// menuManager, xsdEditor.getSelectionManager());
// drill down from outline view
getTreeViewer().getControl().addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
ISelection iSelection = getTreeViewer().getSelection();
if (iSelection instanceof StructuredSelection) {
StructuredSelection selection = (StructuredSelection) iSelection;
Object obj = selection.getFirstElement();
if (obj instanceof XSDConcreteComponent) {
XSDConcreteComponent comp = (XSDConcreteComponent) obj;
if (comp.getContainer() instanceof XSDSchema) {
// getXSDEditor().getGraphViewer().setInput(obj);
}
}
}
}
});
}
Aggregations