Source:
protected void browseAction(final Object value) { ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) { @Override protected void initViewerAndProvider() { super.initViewerAndProvider(); getViewer().setComparator(new ViewerComparator(new StringComparator())); } }; dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_containmentFeatureDialogName); final UMLFeatureRestrictedContentProvider contentProvider = new UMLFeatureRestrictedContentProvider(null, false); final ReferenceSelector selector = new ReferenceSelector(false) { @Override public void createControls(Composite parent) { super.createControls(parent); this.treeViewer.setComparator(new ViewerComparator(new StringComparator())); } }; selector.setLabelProvider(labelProvider); selector.setContentProvider(contentProvider); final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) { @Override public boolean isValidValue(final Object element) { return element instanceof EReference && ((EReference) element).isMany() && element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations(); } }; dialog.setContentProvider(treeContentProvider); dialog.setLabelProvider(labelProvider); if (null != value) { dialog.setInitialElementSelections(Collections.singletonList(value)); } int result = dialog.open(); if (result == Window.OK) { Object[] newValue = dialog.getResult(); if (null == newValue) { return; } if (0 == newValue.length) { setPasteElementContainementFeature(null); } else { Object selectedValue = newValue[0]; setPasteElementContainementFeature((EStructuralFeature) selectedValue); } } }

Target:
protected void browseAction(final Object value) { ITreeSelectorDialog dialog = new TreeSelectorDialog(getShell()) { @Override protected void initViewerAndProvider() { super.initViewerAndProvider(); getViewer().setComparator(new ViewerComparator(new StringComparator())); } }; dialog.setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.PasteEObjectConfigurationDialog_containmentFeatureDialogName); final UMLFeatureRestrictedContentProvider contentProvider = new UMLFeatureRestrictedContentProvider(null, false); final ReferenceSelector selector = new ReferenceSelector(false) { @Override public void createControls(final Composite parent) { super.createControls(parent); this.treeViewer.setComparator(new ViewerComparator(new StringComparator())); } }; selector.setLabelProvider(labelProvider); selector.setContentProvider(contentProvider); final ITreeContentProvider treeContentProvider = new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) contentProvider, selector) { @Override public boolean isValidValue(final Object element) { return element instanceof EReference && ((EReference) element).isMany() && element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations(); } }; dialog.setContentProvider(treeContentProvider); dialog.setLabelProvider(labelProvider); if (null != value) { dialog.setInitialElementSelections(Collections.singletonList(value)); } int result = dialog.open(); if (Window.OK == result) { Object[] newValue = dialog.getResult(); if (null == newValue) { return; } if (0 == newValue.length) { setPasteElementContainementFeature(null); } else { Object selectedValue = newValue[0]; setPasteElementContainementFeature((EStructuralFeature) selectedValue); } } }