Tree tree = toolkit.createTree(schemaSection, SWT.NONE);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
schemaSection.setClient(tree);
final Menu menu = new Menu(Display.getCurrent().getActiveShell(), SWT.POP_UP);
MenuItem itemNewContentTypeDefinition = new MenuItem(menu, SWT.PUSH);
itemNewContentTypeDefinition.setText("Content Type Definition");
itemNewContentTypeDefinition.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
WGContentTypeDefinition cType = _model.createContentTypeDefinition();
_treeViewer.expandToLevel(cType, 1);
_treeViewer.setSelection(new SingleStructuredSelection(cType));
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
MenuItem itemNewAreaDefinition = new MenuItem(menu, SWT.PUSH);
itemNewAreaDefinition.setText("Area Definition");
itemNewAreaDefinition.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
WGAreaDefinition area = _model.createAreaDefinition();
_treeViewer.expandToLevel(area, 1);
_treeViewer.setSelection(new SingleStructuredSelection(area));
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
MenuItem itemNewLanguageDefinition = new MenuItem(menu, SWT.PUSH);
itemNewLanguageDefinition.setText("Language Definition");
itemNewLanguageDefinition.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
WGLanguageDefinition lang = _model.createLanguageDefinition();
_treeViewer.expandToLevel(lang, 1);
_treeViewer.setSelection(new SingleStructuredSelection(lang));
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
final ToolBar schemaSectionToolBar = new ToolBar(schemaSection, SWT.FLAT);
final ToolItem schemaSectionItemNew = new ToolItem(schemaSectionToolBar, SWT.DROP_DOWN);
schemaSectionItemNew.setText("new");
schemaSectionItemNew.setImage(Plugin.getDefault().getImageRegistry().get(Plugin.IMAGE_SCHEMADEFINITION_ADD));
schemaSectionItemNew.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Rectangle rect = schemaSectionItemNew.getBounds();
Point pt = new Point(rect.x, rect.y + rect.height);
pt = schemaSectionToolBar.toDisplay(pt);
menu.setLocation(pt.x, pt.y);
menu.setVisible(true);
}
}
);
final ToolItem schemaSectionItemDelete = new ToolItem(schemaSectionToolBar, SWT.PUSH);