Search in sources :

Example 1 with IndexPropertiesEditionPart

use of org.obeonetwork.dsl.database.parts.IndexPropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class IndexPropertiesEditionComponent method initPart.

/**
 * {@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 Index index = (Index) elt;
        final IndexPropertiesEditionPart indexPart = (IndexPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(DatabaseViewsRepository.Index.Properties.name))
            indexPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, index.getName()));
        if (isAccessible(DatabaseViewsRepository.Index.Properties.qualifier))
            indexPart.setQualifier(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, index.getQualifier()));
        if (isAccessible(DatabaseViewsRepository.Index.Properties.unique)) {
            indexPart.setUnique(index.isUnique());
        }
        if (isAccessible(DatabaseViewsRepository.Index.Properties.cardinality)) {
            indexPart.setCardinality(EEFConverterUtil.convertToString(EcorePackage.Literals.EINT, index.getCardinality()));
        }
        if (isAccessible(DatabaseViewsRepository.Index.Properties.indexType))
            indexPart.setIndexType(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, index.getIndexType()));
        if (isAccessible(DatabaseViewsRepository.Index.Properties.comments))
            indexPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, index.getComments()));
        if (isAccessible(DatabaseViewsRepository.Index.Properties.elements)) {
            elementsSettings = new ReferencesTableSettings(index, DatabasePackage.eINSTANCE.getIndex_Elements());
            indexPart.initElements(elementsSettings);
        }
        if (isAccessible(DatabaseViewsRepository.Index.Properties.elements)) {
            indexPart.addFilterToElements(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) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof IndexElement);
                }
            });
        // Start of user code for additional businessfilters for elements
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : IndexPropertiesEditionPart(org.obeonetwork.dsl.database.parts.IndexPropertiesEditionPart) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Index(org.obeonetwork.dsl.database.Index) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) IndexElement(org.obeonetwork.dsl.database.IndexElement)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 Index (org.obeonetwork.dsl.database.Index)1 IndexElement (org.obeonetwork.dsl.database.IndexElement)1 IndexPropertiesEditionPart (org.obeonetwork.dsl.database.parts.IndexPropertiesEditionPart)1