/** * {@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 Reference reference = (Reference) elt; final ReferencePropertiesEditionPart referencePart = (ReferencePropertiesEditionPart) editingPart; // init values if (isAccessible(EnvironmentViewsRepository.Reference.Properties.name)) referencePart.setName( EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, reference.getName())); if (isAccessible(EnvironmentViewsRepository.Reference.Properties.referencedType)) { // init part referencedTypeSettings = new EObjectFlatComboSettings( reference, EnvironmentPackage.eINSTANCE.getReference_ReferencedType()); referencePart.initReferencedType(referencedTypeSettings); // set the button mode referencePart.setReferencedTypeButtonMode(ButtonsModeEnum.BROWSE); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.multiplicity)) { referencePart.initMultiplicity( EEFUtils.choiceOfValues( reference, EnvironmentPackage.eINSTANCE.getProperty_Multiplicity()), reference.getMultiplicity()); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.isComposite)) { referencePart.setIsComposite(reference.isIsComposite()); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.navigable)) { referencePart.setNavigable(reference.isNavigable()); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.oppositeOf)) { // init part oppositeOfSettings = new EObjectFlatComboSettings( reference, EnvironmentPackage.eINSTANCE.getReference_OppositeOf()); referencePart.initOppositeOf(oppositeOfSettings); // set the button mode referencePart.setOppositeOfButtonMode(ButtonsModeEnum.BROWSE); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.identifier)) { referencePart.setIdentifier(reference.isIsIdentifier()); } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.description)) referencePart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, reference.getDescription())); // init filters if (isAccessible(EnvironmentViewsRepository.Reference.Properties.referencedType)) { referencePart.addFilterToReferencedType( 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 StructuredType); } }); // Start of user code for additional businessfilters for referencedType // End of user code } if (isAccessible(EnvironmentViewsRepository.Reference.Properties.oppositeOf)) { referencePart.addFilterToOppositeOf( 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 String && element.equals("")) || (element instanceof Reference); // $NON-NLS-1$ } }); // Start of user code for additional businessfilters for oppositeOf // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification) */ public void updatePart(Notification msg) { super.updatePart(msg); if (editingPart.isVisible()) { ReferencePropertiesEditionPart referencePart = (ReferencePropertiesEditionPart) editingPart; if (EnvironmentPackage.eINSTANCE.getProperty_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.name)) { if (msg.getNewValue() != null) { referencePart.setName( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { referencePart.setName(""); } } if (EnvironmentPackage.eINSTANCE.getReference_ReferencedType().equals(msg.getFeature()) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.referencedType)) referencePart.setReferencedType((EObject) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getProperty_Multiplicity().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && isAccessible(EnvironmentViewsRepository.Reference.Properties.multiplicity)) referencePart.setMultiplicity((MultiplicityKind) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_IsComposite().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.isComposite)) referencePart.setIsComposite((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_Navigable().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.navigable)) referencePart.setNavigable((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getReference_OppositeOf().equals(msg.getFeature()) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.oppositeOf)) referencePart.setOppositeOf((EObject) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getProperty_IsIdentifier().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.identifier)) referencePart.setIdentifier((Boolean) msg.getNewValue()); if (EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && referencePart != null && isAccessible(EnvironmentViewsRepository.Reference.Properties.description)) { if (msg.getNewValue() != null) { referencePart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { referencePart.setDescription(""); } } } }