/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification) */ public void updatePart(Notification msg) { if (editingPart.isVisible()) { PropertiesEditionElementPropertiesEditionPart basePart = (PropertiesEditionElementPropertiesEditionPart) editingPart; if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Name().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.name)) { if (msg.getNewValue() != null) { basePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setName(""); } } if (MappingPackage.eINSTANCE.getAbstractPropertyBinding_Views().equals(msg.getFeature()) && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.views)) basePart.updateViews(); if (MappingPackage.eINSTANCE.getEMFPropertyBinding_Model().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.model)) basePart.setModel((EObject) msg.getNewValue()); if (ComponentsPackage.eINSTANCE.getEEFElement_HelpID().equals(msg.getFeature()) && basePart != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.helpID)) { if (msg.getNewValue() != null) { basePart.setHelpID( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setHelpID(""); } } } }
/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, * int, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.resource.ResourceSet) */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final PropertiesEditionElement propertiesEditionElement = (PropertiesEditionElement) elt; final PropertiesEditionElementPropertiesEditionPart basePart = (PropertiesEditionElementPropertiesEditionPart) editingPart; // init values if (propertiesEditionElement.getName() != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.name)) basePart.setName( EEFConverterUtil.convertToString( EcorePackage.Literals.ESTRING, propertiesEditionElement.getName())); if (isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.views)) { viewsSettings = new ReferencesTableSettings( propertiesEditionElement, MappingPackage.eINSTANCE.getAbstractPropertyBinding_Views()); basePart.initViews(viewsSettings); } if (isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.model)) { // init part modelSettings = new EObjectFlatComboSettings( propertiesEditionElement, MappingPackage.eINSTANCE.getEMFPropertyBinding_Model()); basePart.initModel(modelSettings); // set the button mode basePart.setModelButtonMode(ButtonsModeEnum.BROWSE); } if (propertiesEditionElement.getHelpID() != null && isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Properties.helpID)) basePart.setHelpID( EEFConverterUtil.convertToString( EcorePackage.Literals.ESTRING, propertiesEditionElement.getHelpID())); // init filters if (isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.views)) { basePart.addFilterToViews( new ViewerFilter() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof EObject) return (!basePart.isContainedInViewsTable((EObject) element)); return false; } }); basePart.addFilterToViews(new EObjectStrictFilter(ViewsPackage.Literals.ELEMENT_EDITOR)); basePart.addFilterToViews( new ViewerFilter() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { Object result = EEFUtils.choiceOfValues( PropertiesEditionElementBasePropertiesEditionComponent.this.semanticObject, MappingPackage.eINSTANCE.getAbstractPropertyBinding_Views()); if (result instanceof Collection) { return ((Collection) result).contains(element); } else if (result instanceof ResourceSet && element instanceof EObject) { return ((EObject) element).eResource() != null && ((EObject) element).eResource().getResourceSet() != null && ((EObject) element).eResource().getResourceSet().equals(result); } return element instanceof Resource; } }); // Start of user code for additional businessfilters for views // End of user code } if (isAccessible(ComponentsViewsRepository.PropertiesEditionElement.Binding.model)) { basePart.addFilterToModel( new ViewerFilter() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof EStructuralFeature); } }); // Start of user code for additional businessfilters for model // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }