Search in sources :

Example 1 with ExpressionEditDialog

use of org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog in project tdq-studio-se by Talend.

the class IndicatorDefinitionMaterPage method createExpressionEditButton.

/**
 * DOC yyi 2009-09-11 Feature:9030.
 *
 * @param expressComp
 * @param patternText
 *
 * @return
 */
private void createExpressionEditButton(Composite expressComp, final Text patternText, final CCombo combo, final Text dbVersionText) {
    Button editButton = new Button(expressComp, SWT.PUSH);
    // $NON-NLS-1$
    editButton.setText(DefaultMessagesImpl.getString("IndicatorDefinitionMaterPage.editExpression"));
    // $NON-NLS-1$
    editButton.setToolTipText(DefaultMessagesImpl.getString("IndicatorDefinitionMaterPage.editExpression"));
    editButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final ExpressionEditDialog editDialog = initExpresstionEditDialog(combo, dbVersionText.getText(), patternText.getText());
            if (Dialog.OK == editDialog.open()) {
                patternText.setText(editDialog.getTempExpression().getBody());
                handleSelectExpression(combo, editDialog);
                setDirty(true);
            }
        }
    });
}
Also used : Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExpressionEditDialog(org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog)

Example 2 with ExpressionEditDialog

use of org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog in project tdq-studio-se by Talend.

the class UDIMasterPage method initExpresstionEditDialog.

@Override
protected ExpressionEditDialog initExpresstionEditDialog(final CCombo combo, final String version, String patternText) {
    TdExpression tdExpression = getTdExpression(combo, version);
    String language = tdExpression.getLanguage();
    ExpressionEditDialog editDialog = new ExpressionEditDialog(null, patternText, true, cloneExpression(tdExpression));
    editDialog.setVersion(version);
    editDialog.setLanguage(language);
    editDialog.setCategory(category);
    if (IndicatorCategoryHelper.isUserDefMatching(category)) {
        EList<TdExpression> viewValidRowsExpression = ((UDIndicatorDefinition) getCurrentModelElement()).getViewValidRowsExpression();
        TdExpression viewValidRows = getCurrentLanguageExp(viewValidRowsExpression, language, version);
        if (isDirty()) {
            viewValidRows = tempViewValidRowsExpressionMap.get(combo);
        }
        editDialog.setTempViewValidRowsExp(cloneExpression(viewValidRows));
        EList<TdExpression> viewInvalidRowsExpression = ((UDIndicatorDefinition) getCurrentModelElement()).getViewInvalidRowsExpression();
        TdExpression viewInvalidRows = getCurrentLanguageExp(viewInvalidRowsExpression, language, version);
        if (isDirty()) {
            viewInvalidRows = tempViewInvalidRowsExpressionMap.get(combo);
        }
        editDialog.setTempViewInvalidRowsExp(cloneExpression(viewInvalidRows));
        EList<TdExpression> viewValidValuesExpression = ((UDIndicatorDefinition) getCurrentModelElement()).getViewValidValuesExpression();
        TdExpression viewValidValues = getCurrentLanguageExp(viewValidValuesExpression, language, version);
        if (isDirty()) {
            viewValidValues = tempViewValidValuesExpressionMap.get(combo);
        }
        editDialog.setTempViewValidValuesExp(cloneExpression(viewValidValues));
        EList<TdExpression> viewInvalidValuesExpression = ((UDIndicatorDefinition) getCurrentModelElement()).getViewInvalidValuesExpression();
        TdExpression viewInvalidValues = getCurrentLanguageExp(viewInvalidValuesExpression, language, version);
        if (isDirty()) {
            viewInvalidValues = tempViewInvalidValuesExpressionMap.get(combo);
        }
        editDialog.setTempViewInvalidValuesExp(cloneExpression(viewInvalidValues));
    } else {
        EList<TdExpression> viewRowsExpression = ((UDIndicatorDefinition) getCurrentModelElement()).getViewRowsExpression();
        TdExpression viewRows = getCurrentLanguageExp(viewRowsExpression, language, version);
        if (isDirty()) {
            viewRows = tempViewRowsExpressionMap.get(combo);
        }
        editDialog.setTempViewRowsExp(cloneExpression(viewRows));
    }
    return editDialog;
}
Also used : TdExpression(org.talend.cwm.relational.TdExpression) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) ExpressionEditDialog(org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog)

Example 3 with ExpressionEditDialog

use of org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog in project tdq-studio-se by Talend.

the class IndicatorDefinitionMaterPage method initExpresstionEditDialog.

protected ExpressionEditDialog initExpresstionEditDialog(final CCombo combo, final String version, String patternText) {
    TdExpression tdExpression = getTdExpression(combo, version);
    String language = tdExpression.getLanguage();
    ExpressionEditDialog editDialog = new ExpressionEditDialog(null, patternText, false, cloneExpression(tdExpression));
    editDialog.setVersion(version);
    editDialog.setLanguage(language);
    editDialog.setCategory(category);
    return editDialog;
}
Also used : TdExpression(org.talend.cwm.relational.TdExpression) ExpressionEditDialog(org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog)

Aggregations

ExpressionEditDialog (org.talend.dataprofiler.core.ui.dialog.ExpressionEditDialog)3 TdExpression (org.talend.cwm.relational.TdExpression)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)1