Search in sources :

Example 26 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project statecharts by Yakindu.

the class TypesUtil method prependContainingFeatureName.

private static void prependContainingFeatureName(StringBuilder id, EObject container) {
    EStructuralFeature feature = container.eContainingFeature();
    if (feature != null) {
        String name;
        if (feature.isMany()) {
            Object elements = container.eContainer().eGet(feature);
            int index = 0;
            if (elements instanceof BasicEList) {
                BasicEList elementList = (BasicEList) elements;
                index = elementList.indexOf(container);
            }
            name = feature.getName() + index;
        } else {
            name = feature.getName();
        }
        id.insert(0, ID_SEPARATOR);
        id.insert(0, name);
    }
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) EObject(org.eclipse.emf.ecore.EObject)

Example 27 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project tdq-studio-se by Talend.

the class ColumnSetMultiValueIndicatorImpl method getColumnHeaders.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<String> getColumnHeaders() {
    EList<String> headers = new BasicEList<String>();
    // shuold keep the order of the columns, when show the data in result page need to follow the order
    for (ModelElement column : analyzedColumns) {
        if (isSameMiningType(column, DataminingType.INTERVAL)) {
            // add numerical or date columns with formatted heander name if numeric or date functions defined in
            // indicator definition.
            final MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
            final TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
            if (tdColumn != null) {
                // For database items
                addDBColumnToHeaderList(headers, column, tdColumn);
            } else if (mdColumn != null) {
                // For file items.
                addFileColumnToHeaderList(headers, column, mdColumn);
            } else {
                // Never go here
                log.error("invalid data mining type for " + column);
            }
        } else {
            headers.add(column.getName());
        }
    }
    headers.add(this.getCountAll());
    return headers;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 28 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project tdq-studio-se by Talend.

the class ColumnSetMultiValueIndicatorImpl method getDateColumns.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<ModelElement> getDateColumns() {
    EList<ModelElement> dateColumns = new BasicEList<ModelElement>();
    if (analyzedColumns != null) {
        for (ModelElement column : analyzedColumns) {
            final MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
            final TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
            if (tdColumn != null) {
                if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isDateInSQL(tdColumn.getSqlDataType().getJavaDataType())) {
                    dateColumns.add(column);
                }
            } else if (mdColumn != null) {
                int javaType = TalendTypeConvert.convertToJDBCType(mdColumn.getTalendType());
                if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isDateInSQL(javaType)) {
                    dateColumns.add(column);
                }
            }
        }
    }
    return dateColumns;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 29 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project InformationSystem by ObeoNetwork.

the class DBindingEditorCreationDescriptionImpl method getMappings.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.sirius.viewpoint.description.tool.impl.RepresentationCreationDescriptionImpl#getMappings()
 * @generated NOT
 */
@Override
public EList<RepresentationElementMapping> getMappings() {
    if (this.eResource() == null) {
        throw new UnsupportedOperationException();
    }
    ECrossReferenceAdapter crossReferencer = ECrossReferenceAdapter.getCrossReferenceAdapter(this.eResource().getResourceSet());
    if (crossReferencer == null) {
        throw new UnsupportedOperationException();
    }
    final List<RepresentationElementMapping> mappings = new LinkedList<RepresentationElementMapping>();
    final Collection<Setting> settings = crossReferencer.getInverseReferences(this, true);
    for (final Setting setting : settings) {
        final EObject eReferencer = setting.getEObject();
        final EStructuralFeature eFeature = setting.getEStructuralFeature();
        if (eReferencer instanceof RepresentationElementMapping && eFeature.equals(org.eclipse.sirius.viewpoint.description.DescriptionPackage.eINSTANCE.getRepresentationElementMapping_DetailDescriptions())) {
            mappings.add((RepresentationElementMapping) eReferencer);
        }
    }
    return new BasicEList<RepresentationElementMapping>(mappings);
}
Also used : ECrossReferenceAdapter(org.eclipse.emf.ecore.util.ECrossReferenceAdapter) RepresentationElementMapping(org.eclipse.sirius.viewpoint.description.RepresentationElementMapping) Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) BasicEList(org.eclipse.emf.common.util.BasicEList) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) LinkedList(java.util.LinkedList)

Example 30 with BasicEList

use of org.eclipse.emf.common.util.BasicEList in project InformationSystem by ObeoNetwork.

the class ColumnPropertiesEditionPartForm method createLiteralsMultiValuedEditor.

/**
 */
protected Composite createLiteralsMultiValuedEditor(FormToolkit widgetFactory, Composite parent) {
    // $NON-NLS-1$
    literals = widgetFactory.createText(parent, "", SWT.READ_ONLY);
    GridData literalsData = new GridData(GridData.FILL_HORIZONTAL);
    literalsData.horizontalSpan = 2;
    literals.setLayoutData(literalsData);
    EditingUtils.setID(literals, DatabaseViewsRepository.Column.Properties.literals);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(literals, "eef::MultiValuedEditor::field");
    editLiterals = widgetFactory.createButton(parent, getDescription(DatabaseViewsRepository.Column.Properties.literals, DatabaseMessages.ColumnPropertiesEditionPart_LiteralsLabel), SWT.NONE);
    GridData editLiteralsData = new GridData();
    editLiterals.setLayoutData(editLiteralsData);
    editLiterals.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            EEFFeatureEditorDialog dialog = new EEFFeatureEditorDialog(// $NON-NLS-1$
            literals.getShell(), // $NON-NLS-1$
            "Column", // $NON-NLS-1$
            new AdapterFactoryLabelProvider(adapterFactory), literalsList, TypesLibraryPackage.eINSTANCE.getTypeInstance_Literals().getEType(), null, false, true, null, null);
            if (dialog.open() == Window.OK) {
                literalsList = dialog.getResult();
                if (literalsList == null) {
                    literalsList = new BasicEList();
                }
                literals.setText(literalsList.toString());
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ColumnPropertiesEditionPartForm.this, DatabaseViewsRepository.Column.Properties.literals, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(literalsList)));
                setHasChanged(true);
            }
        }
    });
    EditingUtils.setID(editLiterals, DatabaseViewsRepository.Column.Properties.literals);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(editLiterals, "eef::MultiValuedEditor::browsebutton");
    // End of user code
    return parent;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) BasicEList(org.eclipse.emf.common.util.BasicEList) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent) EEFFeatureEditorDialog(org.eclipse.emf.eef.runtime.ui.widgets.EEFFeatureEditorDialog)

Aggregations

BasicEList (org.eclipse.emf.common.util.BasicEList)82 Test (org.junit.Test)25 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)16 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)16 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)16 EEFFeatureEditorDialog (org.eclipse.emf.eef.runtime.ui.widgets.EEFFeatureEditorDialog)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)16 GridData (org.eclipse.swt.layout.GridData)16 EObject (org.eclipse.emf.ecore.EObject)13 TdExpression (org.talend.cwm.relational.TdExpression)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)9 Button (org.eclipse.swt.widgets.Button)8 EList (org.eclipse.emf.common.util.EList)7 ObjectPropertyType (org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType)7 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)7 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)7 ProductVersion (org.talend.utils.ProductVersion)7 Property (org.eclipse.vorto.core.api.model.datatype.Property)6 FunctionblockProperty (org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)6