/** * {@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 Criteria criteria = (Criteria) elt; final CriteriaPropertiesEditionPart basePart = (CriteriaPropertiesEditionPart) editingPart; // init values if (criteria.getIdentifier() != null && isAccessible(EurViewsRepository.Criteria.Properties.identifier)) basePart.setIdentifier( EEFConverterUtil.convertToString( ArmPackage.eINSTANCE.getString(), criteria.getIdentifier())); if (criteria.getDescription() != null && isAccessible(EurViewsRepository.Criteria.Properties.description)) basePart.setDescription( EEFConverterUtil.convertToString( ArmPackage.eINSTANCE.getString(), criteria.getDescription())); if (criteria.getContent() != null && isAccessible(EurViewsRepository.Criteria.Properties.content)) basePart.setContent( EEFConverterUtil.convertToString( ArmPackage.eINSTANCE.getString(), criteria.getContent())); if (isAccessible(EurViewsRepository.Criteria.Properties.isTagged)) { isTaggedSettings = new ReferencesTableSettings(criteria, ArmPackage.eINSTANCE.getModelElement_IsTagged()); basePart.initIsTagged(isTaggedSettings); } if (isAccessible(EurViewsRepository.Criteria.Properties.context)) { contextSettings = new ReferencesTableSettings(criteria, EurPackage.eINSTANCE.getCriteria_Context()); basePart.initContext(contextSettings); } if (isAccessible(EurViewsRepository.Criteria.Properties.assumption)) { assumptionSettings = new ReferencesTableSettings(criteria, EurPackage.eINSTANCE.getCriteria_Assumption()); basePart.initAssumption(assumptionSettings); } // init filters basePart.addFilterToIsTagged( 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 TaggedValue); // $NON-NLS-1$ } }); // Start of user code for additional businessfilters for isTagged // End of user code basePart.addFilterToContext( 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.isContainedInContextTable((EObject) element)); return element instanceof Resource; } }); basePart.addFilterToContext(new EObjectFilter(EurPackage.eINSTANCE.getContext())); // Start of user code for additional businessfilters for context // End of user code basePart.addFilterToAssumption( 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.isContainedInAssumptionTable((EObject) element)); return element instanceof Resource; } }); basePart.addFilterToAssumption(new EObjectFilter(EurPackage.eINSTANCE.getAssumption())); // Start of user code for additional businessfilters for assumption // 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#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) */ public void updateSemanticModel(final IPropertiesEditionEvent event) { Criteria criteria = (Criteria) semanticObject; if (EurViewsRepository.Criteria.Properties.identifier == event.getAffectedEditor()) { criteria.setIdentifier( (java.lang.String) EEFConverterUtil.createFromString( ArmPackage.eINSTANCE.getString(), (String) event.getNewValue())); } if (EurViewsRepository.Criteria.Properties.description == event.getAffectedEditor()) { criteria.setDescription( (java.lang.String) EEFConverterUtil.createFromString( ArmPackage.eINSTANCE.getString(), (String) event.getNewValue())); } if (EurViewsRepository.Criteria.Properties.content == event.getAffectedEditor()) { criteria.setContent( (java.lang.String) EEFConverterUtil.createFromString( ArmPackage.eINSTANCE.getString(), (String) event.getNewValue())); } if (EurViewsRepository.Criteria.Properties.isTagged == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext( editingContext, this, isTaggedSettings, editingContext.getAdapterFactory()); PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext .getAdapterFactory() .adapt(semanticObject, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy instanceof CreateEditingPolicy) { policy.execute(); } } } else if (event.getKind() == PropertiesEditionEvent.EDIT) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext( editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory()); PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext .getAdapterFactory() .adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy editionPolicy = provider.getPolicy(context); if (editionPolicy != null) { editionPolicy.execute(); } } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { isTaggedSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { isTaggedSettings.move(event.getNewIndex(), (TaggedValue) event.getNewValue()); } } if (EurViewsRepository.Criteria.Properties.context == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { if (event.getNewValue() instanceof Context) { contextSettings.addToReference((EObject) event.getNewValue()); } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { contextSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { contextSettings.move(event.getNewIndex(), (Context) event.getNewValue()); } } if (EurViewsRepository.Criteria.Properties.assumption == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { if (event.getNewValue() instanceof Assumption) { assumptionSettings.addToReference((EObject) event.getNewValue()); } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { assumptionSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { assumptionSettings.move(event.getNewIndex(), (Assumption) event.getNewValue()); } } }