use of org.talend.dataquality.indicators.definition.CharactersMapping in project tdq-studio-se by Talend.
the class IndicatorDefinitionMaterPage method createCMAddButton.
/**
* DOC xqliu Comment method "createCMAddButton".
*
* @param composite
*/
private void createCMAddButton(Composite composite) {
final Button addButton = new Button(composite, SWT.NONE);
addButton.setImage(ImageLib.getImage(ImageLib.ADD_ACTION));
// $NON-NLS-1$
addButton.setToolTipText(DefaultMessagesImpl.getString("PatternMasterDetailsPage.add"));
GridData labelGd = new GridData();
labelGd.horizontalAlignment = SWT.CENTER;
labelGd.widthHint = 65;
addButton.setLayoutData(labelGd);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
remainDBTypeListCM.clear();
remainDBTypeListCM.addAll(allDBTypeList);
for (CharactersMapping cm : charactersMappingMapTemp.values()) {
String language = cm.getLanguage();
String languageName = PatternLanguageType.findNameByLanguage(language);
remainDBTypeListCM.remove(languageName);
}
if (remainDBTypeListCM.size() == 0) {
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), // $NON-NLS-1$
DefaultMessagesImpl.getString("PatternMasterDetailsPage.warning"), // $NON-NLS-1$
DefaultMessagesImpl.getString("PatternMasterDetailsPage.patternExpression"));
return;
}
String language = PatternLanguageType.findLanguageByName(remainDBTypeListCM.get(0));
CharactersMapping cm = DefinitionFactory.eINSTANCE.createCharactersMapping();
cm.setLanguage(language);
cm.setCharactersToReplace(BODY_CHARACTERS_TO_REPLACE);
cm.setReplacementCharacters(BODY_REPLACEMENT_CHARACTERS);
createNewCharactersMappingLine(language, cm);
charactersMappingMapTemp.put(language, cm);
charactersMappingSection.setExpanded(true);
setDirty(true);
}
});
}
use of org.talend.dataquality.indicators.definition.CharactersMapping in project tdq-studio-se by Talend.
the class IndicatorDefinitionMaterPage method createCharactersMappingComp.
/**
* DOC xqliu Comment method "createCharactersMappingComp".
*
* @param charactersMappingSection
* @return
*/
private Composite createCharactersMappingComp() {
Composite composite = toolkit.createComposite(charactersMappingSection);
composite.setLayout(new GridLayout());
charactersMappingLineComp = new Composite(composite, SWT.NONE);
charactersMappingLineComp.setLayout(new GridLayout());
charactersMappingLineComp.setLayoutData(new GridData(GridData.FILL_BOTH));
if (getCurrentModelElement() != null) {
EList<CharactersMapping> charactersMappings = getCurrentModelElement().getCharactersMapping();
if (charactersMappings != null && charactersMappings.size() > 0) {
for (CharactersMapping charactersMapping : charactersMappings) {
recordCharactersMapping(charactersMapping);
}
}
charactersMappingMapTemp.clear();
for (String key : charactersMappingMap.keySet()) {
charactersMappingMapTemp.put(key, cloneCharactersMapping(charactersMappingMap.get(key)));
}
for (String language : charactersMappingMapTemp.keySet()) {
createNewCharactersMappingLine(language, charactersMappingMapTemp.get(language));
}
}
createCMAddButton(composite);
return composite;
}
Aggregations