Search in sources :

Example 1 with EObjectStrictFilter

use of org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter in project InformationSystem by ObeoNetwork.

the class DataBasePropertiesEditionComponent 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 DataBase dataBase = (DataBase) elt;
        final DataBasePropertiesEditionPart dataBasePart = (DataBasePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(DatabaseViewsRepository.DataBase_.Properties.name))
            dataBasePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, dataBase.getName()));
        if (isAccessible(DatabaseViewsRepository.DataBase_.Properties.url))
            dataBasePart.setUrl(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, dataBase.getUrl()));
        if (isAccessible(DatabaseViewsRepository.DataBase_.Properties.comments))
            dataBasePart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, dataBase.getComments()));
        if (isAccessible(DatabaseViewsRepository.DataBase_.Properties.usedLibraries)) {
            usedLibrariesSettings = new ReferencesTableSettings(dataBase, TypesLibraryPackage.eINSTANCE.getTypesLibraryUser_UsedLibraries());
            dataBasePart.initUsedLibraries(usedLibrariesSettings);
        }
        if (isAccessible(DatabaseViewsRepository.DataBase_.Properties.usedLibraries)) {
            dataBasePart.addFilterToUsedLibraries(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 (!dataBasePart.isContainedInUsedLibrariesTable((EObject) element));
                    return element instanceof String && element.equals("");
                }
            });
            dataBasePart.addFilterToUsedLibraries(new EObjectStrictFilter(TypesLibraryPackage.Literals.TYPES_LIBRARY));
        // Start of user code for additional businessfilters for usedLibraries
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) EObject(org.eclipse.emf.ecore.EObject) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) DataBasePropertiesEditionPart(org.obeonetwork.dsl.database.parts.DataBasePropertiesEditionPart) DataBase(org.obeonetwork.dsl.database.DataBase)

Example 2 with EObjectStrictFilter

use of org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter in project InformationSystem by ObeoNetwork.

the class PrimaryKeyPropertiesEditionComponent 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 PrimaryKey primaryKey = (PrimaryKey) elt;
        final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
            primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getName()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            columnsSettings = new ReferencesTableSettings(primaryKey, DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
            primaryKeyPart.initColumns(columnsSettings);
        }
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
            primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getComments()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            primaryKeyPart.addFilterToColumns(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 (!primaryKeyPart.isContainedInColumnsTable((EObject) element));
                    return element instanceof String && element.equals("");
                }
            });
            primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
        // Start of user code for additional businessfilters for columns
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) EObject(org.eclipse.emf.ecore.EObject) PrimaryKey(org.obeonetwork.dsl.database.PrimaryKey) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) PrimaryKeyPropertiesEditionPart(org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart)

Example 3 with EObjectStrictFilter

use of org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter in project InformationSystem by ObeoNetwork.

the class RequirementAdvancedPropertiesEditionComponent 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 Requirement requirement = (Requirement) elt;
        final AdvancedPropertiesEditionPart advancedPart = (AdvancedPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(RequirementViewsRepository.Advanced.rationale))
            advancedPart.setRationale(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, requirement.getRationale()));
        if (isAccessible(RequirementViewsRepository.Advanced.acceptanceCriteria))
            advancedPart.setAcceptanceCriteria(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, requirement.getAcceptanceCriteria()));
        if (isAccessible(RequirementViewsRepository.Advanced.referencedObject)) {
            referencedObjectSettings = new ReferencesTableSettings(requirement, RequirementPackage.eINSTANCE.getRequirement_ReferencedObject());
            advancedPart.initReferencedObject(referencedObjectSettings);
        }
        if (isAccessible(RequirementViewsRepository.Advanced.referencedObject)) {
            advancedPart.addFilterToReferencedObject(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 (!advancedPart.isContainedInReferencedObjectTable((EObject) element));
                    return element instanceof String && element.equals("");
                }
            });
            advancedPart.addFilterToReferencedObject(new EObjectStrictFilter(EcorePackage.Literals.EOBJECT));
        // Start of user code for additional businessfilters for referencedObject
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : Requirement(org.obeonetwork.dsl.requirement.Requirement) EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) EObject(org.eclipse.emf.ecore.EObject) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) AdvancedPropertiesEditionPart(org.obeonetwork.dsl.requirement.parts.AdvancedPropertiesEditionPart)

Example 4 with EObjectStrictFilter

use of org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter in project InformationSystem by ObeoNetwork.

the class TablePrimaryKeyPropertiesEditionComponent 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);
        if (editingPart instanceof CompositePropertiesEditionPart) {
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(pkNameSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(pkColumnsSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(pkCommentsSettings);
        }
        final Table table = (Table) elt;
        final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
        // init values
        if (pkNameSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
            primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, pkNameSettings.getValue()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            pkColumnsSettings = new ReferencesTableSettings(table, DatabasePackage.eINSTANCE.getTable_PrimaryKey(), DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
            primaryKeyPart.initColumns(pkColumnsSettings);
        }
        if (pkCommentsSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
            primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, pkCommentsSettings.getValue()));
        if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
            primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
        // Start of user code for additional businessfilters for pkColumns
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) Table(org.obeonetwork.dsl.database.Table) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) PrimaryKeyPropertiesEditionPart(org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart)

Example 5 with EObjectStrictFilter

use of org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter in project InformationSystem by ObeoNetwork.

the class RepositoryPropertiesEditionComponent 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 Repository repository = (Repository) elt;
        final RepositoryPropertiesEditionPart repositoryPart = (RepositoryPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(RequirementViewsRepository.Repository.Repository_.name))
            repositoryPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, repository.getName()));
        if (isAccessible(RequirementViewsRepository.Repository.Repository_.mainCategories)) {
            mainCategoriesSettings = new ReferencesTableSettings(repository, RequirementPackage.eINSTANCE.getRepository_MainCategories());
            repositoryPart.initMainCategories(mainCategoriesSettings);
        }
        if (isAccessible(RequirementViewsRepository.Repository.Repository_.referencedObject)) {
            referencedObjectSettings = new ReferencesTableSettings(repository, RequirementPackage.eINSTANCE.getRepository_ReferencedObject());
            repositoryPart.initReferencedObject(referencedObjectSettings);
        }
        if (isAccessible(RequirementViewsRepository.Repository.Repository_.mainCategories)) {
            repositoryPart.addFilterToMainCategories(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 Category);
                }
            });
        // Start of user code for additional businessfilters for mainCategories
        // End of user code
        }
        if (isAccessible(RequirementViewsRepository.Repository.Repository_.referencedObject)) {
            repositoryPart.addFilterToReferencedObject(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 (!repositoryPart.isContainedInReferencedObjectTable((EObject) element));
                    return element instanceof String && element.equals("");
                }
            });
            repositoryPart.addFilterToReferencedObject(new EObjectStrictFilter(EcorePackage.Literals.EOBJECT));
        // Start of user code for additional businessfilters for referencedObject
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : Repository(org.obeonetwork.dsl.requirement.Repository) RequirementViewsRepository(org.obeonetwork.dsl.requirement.parts.RequirementViewsRepository) RepositoryPropertiesEditionPart(org.obeonetwork.dsl.requirement.parts.RepositoryPropertiesEditionPart) EObjectStrictFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) Category(org.obeonetwork.dsl.requirement.Category) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) EObject(org.eclipse.emf.ecore.EObject) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

EObjectStrictFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectStrictFilter)5 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)5 EObject (org.eclipse.emf.ecore.EObject)4 Viewer (org.eclipse.jface.viewers.Viewer)4 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)4 PrimaryKeyPropertiesEditionPart (org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart)2 CompositePropertiesEditionPart (org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart)1 DataBase (org.obeonetwork.dsl.database.DataBase)1 PrimaryKey (org.obeonetwork.dsl.database.PrimaryKey)1 Table (org.obeonetwork.dsl.database.Table)1 DataBasePropertiesEditionPart (org.obeonetwork.dsl.database.parts.DataBasePropertiesEditionPart)1 Category (org.obeonetwork.dsl.requirement.Category)1 Repository (org.obeonetwork.dsl.requirement.Repository)1 Requirement (org.obeonetwork.dsl.requirement.Requirement)1 AdvancedPropertiesEditionPart (org.obeonetwork.dsl.requirement.parts.AdvancedPropertiesEditionPart)1 RepositoryPropertiesEditionPart (org.obeonetwork.dsl.requirement.parts.RepositoryPropertiesEditionPart)1 RequirementViewsRepository (org.obeonetwork.dsl.requirement.parts.RequirementViewsRepository)1