protected List<IItemPropertyDescriptor> getChildDescriptors(EObject parent, EObject child, EStructuralFeature feature, int index, final boolean readOnly) { List<IItemPropertyDescriptor> childDescriptors = new ArrayList<IItemPropertyDescriptor>(); IItemPropertySource source = EMFUtils.adapt(child, IItemPropertySource.class); if (source != null) { List<IItemPropertyDescriptor> pds; { final DelegatingWrapperItemProvider ip = new DelegatingWrapperItemProvider(child, parent, feature, index, getAdapterFactory()); pds = ip.getPropertyDescriptors(parent); ip.dispose(); } for (IItemPropertyDescriptor pd : pds) { ((OverrideableCommandOwner)pd).setCommandOwner(child); childDescriptors.add(pd); Object realDescriptor = ReflectionUtils.get(pd, "itemPropertyDescriptor"); if (realDescriptor.getClass().getName().equals(DELEGATING_WRAPPER_ITEM_PROPERTY_DESCRIPTOR_NAME)) realDescriptor = ReflectionUtils.get(realDescriptor, "itemPropertyDescriptor"); ReflectionUtils.set(realDescriptor, "category", pd.getLabelProvider(child).getText(child)); if (readOnly) ReflectionUtils.set(realDescriptor, "isSettable", false); } } // // recurse? // if (child != null) // childDescriptors.addAll(getAllChildDescriptors(child)); return childDescriptors; }
private void addWrappedDescriptors(EPlanElement element, Object reference, DelegatingWrapperItemProvider provider) { wrapperItemProviders.add(provider); for (IItemPropertyDescriptor pd : provider.getPropertyDescriptors(element)) { if (isVisible(element, reference, pd)) { itemPropertyDescriptors.add(pd); } } }
@Override public void dispose() { super.dispose(); for (DelegatingWrapperItemProvider provider : wrapperItemProviders) { provider.dispose(); } wrapperItemProviders.clear(); }