Search in sources :

Example 16 with EObjectFlatComboSettings

use of org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings in project InformationSystem by ObeoNetwork.

the class ViewEventViewEventPropertiesEditionComponent 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 ViewEvent viewEvent = (ViewEvent) elt;
        final ViewEventPropertiesEditionPart viewEventPart = (ViewEventPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(ViewViewsRepository.ViewEvent.Properties.description))
            viewEventPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, viewEvent.getDescription()));
        if (isAccessible(ViewViewsRepository.ViewEvent.Properties.name))
            viewEventPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewEvent.getName()));
        if (isAccessible(ViewViewsRepository.ViewEvent.Properties.type)) {
            // init part
            typeSettings = new EObjectFlatComboSettings(viewEvent, ViewPackage.eINSTANCE.getViewEvent_Type());
            viewEventPart.initType(typeSettings);
            // set the button mode
            viewEventPart.setTypeButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(ViewViewsRepository.ViewEvent.Properties.type)) {
            viewEventPart.addFilterToType(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 WidgetEventType);
                }
            });
        // Start of user code for additional businessfilters for type
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) WidgetEventType(org.obeonetwork.dsl.cinematic.toolkits.WidgetEventType) ViewEvent(org.obeonetwork.dsl.cinematic.view.ViewEvent) ViewEventPropertiesEditionPart(org.obeonetwork.dsl.cinematic.view.parts.ViewEventPropertiesEditionPart) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)

Example 17 with EObjectFlatComboSettings

use of org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings in project InformationSystem by ObeoNetwork.

the class SimpleNamedTypePropertiesEditionComponent 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 SimpleNamedType simpleNamedType = (SimpleNamedType) elt;
        final SimpleNamedTypePropertiesEditionPart simpleNamedTypePart = (SimpleNamedTypePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(TypeslibraryViewsRepository.SimpleNamedType.Properties.name))
            simpleNamedTypePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, simpleNamedType.getName()));
        if (isAccessible(TypeslibraryViewsRepository.SimpleNamedType.Properties.type)) {
            // init part
            typeSettings = new EObjectFlatComboSettings(simpleNamedType, TypesLibraryPackage.eINSTANCE.getSimpleNamedType_Type());
            simpleNamedTypePart.initType(typeSettings);
            // set the button mode
            simpleNamedTypePart.setTypeButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(TypeslibraryViewsRepository.SimpleNamedType.Properties.type)) {
            simpleNamedTypePart.addFilterToType(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 TypeInstance);
                }
            });
        // Start of user code for additional businessfilters for type
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) SimpleNamedType(org.obeonetwork.dsl.typeslibrary.SimpleNamedType) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) TypeInstance(org.obeonetwork.dsl.typeslibrary.TypeInstance) SimpleNamedTypePropertiesEditionPart(org.obeonetwork.dsl.typeslibrary.parts.SimpleNamedTypePropertiesEditionPart) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)

Example 18 with EObjectFlatComboSettings

use of org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings in project InformationSystem by ObeoNetwork.

the class ForeignKeyElementPropertiesEditionComponent 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)
 * @generated NOT
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        final ForeignKeyElement foreignKeyElement = (ForeignKeyElement) elt;
        final ForeignKeyElementPropertiesEditionPart foreignKeyElementPart = (ForeignKeyElementPropertiesEditionPart) editingPart;
        // init values
        if (foreignKeyElement.getComments() != null && isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.comments))
            foreignKeyElementPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, foreignKeyElement.getComments()));
        if (isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.fKColumn)) {
            // init part
            fkColumnSettings = new EObjectFlatComboSettings(foreignKeyElement, DatabasePackage.eINSTANCE.getForeignKeyElement_FkColumn());
            foreignKeyElementPart.initFKColumn(fkColumnSettings);
            // set the button mode
            foreignKeyElementPart.setFKColumnButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn)) {
            // init part
            pkColumnSettings = new EObjectFlatComboSettings(foreignKeyElement, DatabasePackage.eINSTANCE.getForeignKeyElement_PkColumn());
            foreignKeyElementPart.initPKColumn(pkColumnSettings);
            // set the button mode
            foreignKeyElementPart.setPKColumnButtonMode(ButtonsModeEnum.BROWSE);
        }
        // Custom code to prevent NPE when creating new FKElement
        ForeignKeyElement fkElt = (ForeignKeyElement) semanticObject;
        if (fkElt.getFkColumn() != null) {
            if (sourceTableSettings.getValue() != null && isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.sourceTable))
                foreignKeyElementPart.setSourceTable(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, sourceTableSettings.getValue()));
        } else {
            EObject container = fkElt.eContainer();
            if (container instanceof ForeignKey) {
                Table table = ((ForeignKey) container).getSourceTable();
                if (table != null) {
                    foreignKeyElementPart.setSourceTable(table.getName());
                }
            }
        }
        if (fkElt.getPkColumn() != null) {
            if (targetTableSettings.getValue() != null && isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.targetTable))
                foreignKeyElementPart.setTargetTable(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, targetTableSettings.getValue()));
        } else {
            EObject container = fkElt.eContainer();
            if (container instanceof ForeignKey) {
                Table table = ((ForeignKey) container).getTargetTable();
                if (table != null) {
                    foreignKeyElementPart.setTargetTable(table.getName());
                }
            }
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.fKColumn)) {
            foreignKeyElementPart.addFilterToFKColumn(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 Column);
                }
            });
        // Start of user code for additional businessfilters for fkColumn
        // End of user code
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn)) {
            foreignKeyElementPart.addFilterToPKColumn(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 Column);
                }
            });
        // Start of user code for additional businessfilters for pkColumn
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ForeignKeyElement(org.obeonetwork.dsl.database.ForeignKeyElement) Table(org.obeonetwork.dsl.database.Table) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Column(org.obeonetwork.dsl.database.Column) EObject(org.eclipse.emf.ecore.EObject) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) ForeignKeyElementPropertiesEditionPart(org.obeonetwork.dsl.database.parts.ForeignKeyElementPropertiesEditionPart) ForeignKey(org.obeonetwork.dsl.database.ForeignKey)

Example 19 with EObjectFlatComboSettings

use of org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings in project InformationSystem by ObeoNetwork.

the class ForeignKeyPropertiesEditionComponent 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 ForeignKey foreignKey = (ForeignKey) elt;
        final ForeignKeyPropertiesEditionPart foreignKeyPart = (ForeignKeyPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.name))
            foreignKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, foreignKey.getName()));
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.target)) {
            // init part
            targetSettings = new EObjectFlatComboSettings(foreignKey, DatabasePackage.eINSTANCE.getForeignKey_Target());
            foreignKeyPart.initTarget(targetSettings);
            // set the button mode
            foreignKeyPart.setTargetButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.elements)) {
            elementsSettings = new ReferencesTableSettings(foreignKey, DatabasePackage.eINSTANCE.getForeignKey_Elements());
            foreignKeyPart.initElements(elementsSettings);
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.comments))
            foreignKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, foreignKey.getComments()));
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.target)) {
            foreignKeyPart.addFilterToTarget(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 Table);
                }
            });
        // Start of user code for additional businessfilters for target
        // End of user code
        }
        if (isAccessible(DatabaseViewsRepository.ForeignKey.Properties.elements)) {
            foreignKeyPart.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 ForeignKeyElement);
                }
            });
        // 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 : ForeignKeyElement(org.obeonetwork.dsl.database.ForeignKeyElement) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) Table(org.obeonetwork.dsl.database.Table) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ForeignKeyPropertiesEditionPart(org.obeonetwork.dsl.database.parts.ForeignKeyPropertiesEditionPart) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) ForeignKey(org.obeonetwork.dsl.database.ForeignKey)

Example 20 with EObjectFlatComboSettings

use of org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings in project InformationSystem by ObeoNetwork.

the class ColumnPropertiesEditionComponent 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(typeSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(lengthSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(precisionSettings);
            ((CompositePropertiesEditionPart) editingPart).getSettings().add(literalsSettings);
        }
        final Column column = (Column) elt;
        final ColumnPropertiesEditionPart columnPart = (ColumnPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(DatabaseViewsRepository.Column.Properties.name))
            columnPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, column.getName()));
        if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.nullable)) {
            columnPart.setNullable(column.isNullable());
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.primaryKey)) {
            columnPart.setPrimaryKey(column.isInPrimaryKey());
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique)) {
            columnPart.setUnique(column.isUnique());
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.autoincrement)) {
            columnPart.setAutoincrement(column.isAutoincrement());
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.sequence_)) {
            // init part
            sequenceSettings = new EObjectFlatComboSettings(column, DatabasePackage.eINSTANCE.getColumn_Sequence());
            columnPart.initSequence(sequenceSettings);
            // set the button mode
            columnPart.setSequenceButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.defaultValue))
            columnPart.setDefaultValue(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, column.getDefaultValue()));
        if (isAccessible(DatabaseViewsRepository.Column.Properties.comments))
            columnPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, column.getComments()));
        if (typeSettings.getSignificantObject() != null && isAccessible(DatabaseViewsRepository.Column.Properties.type)) {
            columnPart.initType(EEFUtils.choiceOfValues(typeSettings.getSignificantObject(), TypesLibraryPackage.eINSTANCE.getTypeInstance_NativeType()), typeSettings.getValue());
        }
        if (lengthSettings.getValue() != null && isAccessible(DatabaseViewsRepository.Column.Properties.TypeAttributes.length))
            columnPart.setLength(EEFConverterUtil.convertToString(EcorePackage.Literals.EINTEGER_OBJECT, lengthSettings.getValue()));
        if (precisionSettings.getValue() != null && isAccessible(DatabaseViewsRepository.Column.Properties.TypeAttributes.precision))
            columnPart.setPrecision(EEFConverterUtil.convertToString(EcorePackage.Literals.EINTEGER_OBJECT, precisionSettings.getValue()));
        if (literalsSettings.getSignificantObject() != null && isAccessible(DatabaseViewsRepository.Column.Properties.literals)) {
            columnPart.setLiterals((EList<?>) literalsSettings.getValue());
        }
        if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.sequence_)) {
            columnPart.addFilterToSequence(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 Sequence);
                }
            });
        // Start of user code for additional businessfilters for sequence
        // End of user code
        }
    // Start of user code for additional businessfilters for type
    // End of user code
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Column(org.obeonetwork.dsl.database.Column) CompositePropertiesEditionPart(org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) Sequence(org.obeonetwork.dsl.database.Sequence) ColumnPropertiesEditionPart(org.obeonetwork.dsl.database.parts.ColumnPropertiesEditionPart)

Aggregations

EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)28 EObject (org.eclipse.emf.ecore.EObject)22 Viewer (org.eclipse.jface.viewers.Viewer)22 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)22 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)11 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)6 ViewEvent (org.obeonetwork.dsl.cinematic.view.ViewEvent)4 Widget (org.obeonetwork.dsl.cinematic.toolkits.Widget)3 ViewAction (org.obeonetwork.dsl.cinematic.view.ViewAction)3 Column (org.obeonetwork.dsl.database.Column)3 ViewContainer (org.obeonetwork.dsl.cinematic.view.ViewContainer)2 ForeignKey (org.obeonetwork.dsl.database.ForeignKey)2 ForeignKeyElement (org.obeonetwork.dsl.database.ForeignKeyElement)2 Table (org.obeonetwork.dsl.database.Table)2 StructuredType (org.obeonetwork.dsl.environment.StructuredType)2 CompositePropertiesEditionPart (org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart)1 Flow (org.obeonetwork.dsl.cinematic.flow.Flow)1 FlowAction (org.obeonetwork.dsl.cinematic.flow.FlowAction)1 FlowState (org.obeonetwork.dsl.cinematic.flow.FlowState)1 SubflowState (org.obeonetwork.dsl.cinematic.flow.SubflowState)1