/** * {@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) */ @Override public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final ItemizedList itemizedList = (ItemizedList) elt; final ItemizedListPropertiesEditionPart basePart = (ItemizedListPropertiesEditionPart) editingPart; // init values if (isAccessible(DocbookViewsRepository.ItemizedList.Properties.mark)) { basePart.setMark( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, itemizedList.getMark())); } if (isAccessible(DocbookViewsRepository.ItemizedList.Properties.listitem)) { listitemSettings = new ReferencesTableSettings( itemizedList, DocbookPackage.eINSTANCE.getItemizedList_Listitem()); basePart.initListitem(listitemSettings); } // init filters if (isAccessible(DocbookViewsRepository.ItemizedList.Properties.listitem)) { basePart.addFilterToListitem( new ViewerFilter() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof ListItem); // $NON-NLS-1$ } }); // Start of user code for additional businessfilters for // listitem // 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) */ @Override public void updateSemanticModel(final IPropertiesEditionEvent event) { ItemizedList itemizedList = (ItemizedList) semanticObject; if (DocbookViewsRepository.ItemizedList.Properties.mark == event.getAffectedEditor()) { itemizedList.setMark( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } if (DocbookViewsRepository.ItemizedList.Properties.listitem == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext( editingContext, this, listitemSettings, 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) { listitemSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { listitemSettings.move(event.getNewIndex(), (ListItem) event.getNewValue()); } } }