protected void customizeButtonGroup(final ButtonGroup<EObject> buttonGroup) { buttonGroup.addAddButton(new AddHandler()); buttonGroup.addDeleteButton(null); buttonGroup.addSeparator(); buttonGroup.addUpButton(null); buttonGroup.addDownButton(null); }
@Override public void bind(final IEMFEditContext context) { super.bind(context); final IEMFEditListProperty emfProperty = EMFEditProperties.list(getEditingDomain(), getEFeature()); fModelObservable = emfProperty.observeDetail(getBaseObservable()); ((IObserving) fModelObservable).getObserved(); fWidget.viewer.setInput(fModelObservable); fButtonGroup.connectTo(fWidget.viewer, fModelObservable, null); register(fWidget.table, IEFPropertyExpressions.EOBJECT_LIST_ID); fSelectionProvider = new ElementSourceSelectionProvider(fWidget.viewer, this); ViewerUtil.setSelectionProvider(fWidget.table, fSelectionProvider); { final int operations = (DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_MOVE); final Transfer[] transfers = new Transfer[] {LocalTransfer.getInstance()}; fWidget.viewer.addDragSupport(operations, transfers, new ViewerDragAdapter(fWidget.viewer)); fWidget.viewer.addDropSupport( operations, transfers, new EditingDomainViewerDropAdapter(getEditingDomain(), fWidget.viewer)); } fSingleSelectionObservable = ViewersObservables.observeSinglePostSelection(fWidget.viewer); fButtonGroup.updateState(); }
@Override public void create(final Composite parent, final IEFFormPage page) { fWidget = page.getToolkit().createPropSingleColumnTable(parent, 10, 25); fWidget.viewer.setContentProvider(new ObservableListContentProvider()); fWidget.viewer.setLabelProvider( new LabelProvider(page.getEditor().getAdapterFactory(), fWidget.viewer)); fButtonGroup = new ButtonGroup<>(parent); fButtonGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); customizeButtonGroup(fButtonGroup); }