Search in sources :

Example 6 with LanguageInfo

use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.

the class LanguageInfoComposite method onMidifyLabelText.

private void onMidifyLabelText() {
    LanguageInfo correspondLangInfo = getLangInfoBySelectionOfLangCombo();
    if (correspondLangInfo == null)
        return;
    if (correspondLangInfo.getLabel().equals(txtLabel.getText().trim()))
        return;
    if ("".equals(txtLabel.getText().trim())) {
        // $NON-NLS-1$
        MessageDialog.openWarning(getShell(), Messages.Warning, Messages.LanguageInfoComposite_InfoCannotbeEmpty);
        txtLabel.setText(correspondLangInfo.getLabel());
    }
    correspondLangInfo.setLabel(txtLabel.getText().trim());
    tvInfos.refresh();
    if (section != null)
        section.autoCommit();
}
Also used : LanguageInfo(com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo)

Example 7 with LanguageInfo

use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.

the class LanguageInfoComposite method onAddLanguageInfo.

private void onAddLanguageInfo() {
    if ("".equals(txtLabel.getText().trim())) {
        // $NON-NLS-1$
        MessageDialog.openWarning(getShell(), Messages.Warning, Messages.LanguageInfoComposite_InfoCannotbeEmpty);
        return;
    }
    LanguageInfo correspondLangInfo = getLangInfoBySelectionOfLangCombo();
    if (correspondLangInfo == null) {
        LanguageInfo newLangInfo = new LanguageInfo(comboLanguage.getText(), Util.lang2iso.get(comboLanguage.getText()), txtLabel.getText().trim());
        infos.add(newLangInfo);
    } else {
        correspondLangInfo.setLabel(txtLabel.getText().trim());
    }
    tvInfos.refresh();
    if (section != null)
        section.autoCommit();
}
Also used : LanguageInfo(com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo)

Example 8 with LanguageInfo

use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.

the class FacetMsgCommitHandler method doSubmit.

@Override
protected boolean doSubmit() throws CommitException {
    XSDAnnotationsStructure xsdAnnoStruct = getXSDAnnotationStruct();
    LinkedHashMap<String, String> langCode2Value = new LinkedHashMap<String, String>();
    for (Entry<String, LanguageInfo> eachLangCode2LangInfo : getCommitedObj().getLangCode2LangInfo().entrySet()) langCode2Value.put(eachLangCode2LangInfo.getKey(), eachLangCode2LangInfo.getValue().getLabel());
    return xsdAnnoStruct.setFactMessage(langCode2Value);
}
Also used : LanguageInfo(com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo) XSDAnnotationsStructure(com.amalto.workbench.utils.XSDAnnotationsStructure) LinkedHashMap(java.util.LinkedHashMap)

Example 9 with LanguageInfo

use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.

the class LanguageInfoCommitHandler method getNeedAddedObjs.

@Override
protected LanguageInfo[] getNeedAddedObjs() {
    List<LanguageInfo> results = new ArrayList<LanguageInfo>();
    Map<String, String> originalLangCode2LangInfo = getOriginalLang2Info();
    for (LanguageInfo eachCurLangInfo : getCommitedObj().getLanguageInfos()) {
        if (originalLangCode2LangInfo.containsKey(eachCurLangInfo.getLanguageISOCode()))
            continue;
        results.add(eachCurLangInfo);
    }
    return results.toArray(new LanguageInfo[0]);
}
Also used : LanguageInfo(com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo) ArrayList(java.util.ArrayList)

Example 10 with LanguageInfo

use of com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo in project tmdm-studio-se by Talend.

the class LanguageInfoSection method initUIContents.

@Override
protected void initUIContents(XSDComponent editedObj) {
    super.initUIContents(editedObj);
    langInfos.clear();
    XSDAnnotationsStructure xsdAnnoStruct = new XSDAnnotationsStructure(curXSDComponent);
    for (Entry<String, String> eachLang2Label : getLang2Info(xsdAnnoStruct).entrySet()) {
        langInfos.add(new LanguageInfo(Util.iso2lang.get(eachLang2Label.getKey()), eachLang2Label.getKey(), eachLang2Label.getValue()));
    }
}
Also used : LanguageInfo(com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo) XSDAnnotationsStructure(com.amalto.workbench.utils.XSDAnnotationsStructure)

Aggregations

LanguageInfo (com.amalto.workbench.detailtabs.sections.model.annotationinfo.langinfo.LanguageInfo)11 XSDAnnotationsStructure (com.amalto.workbench.utils.XSDAnnotationsStructure)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 LanguageInfoComposite (com.amalto.workbench.detailtabs.sections.composites.LanguageInfoComposite)1 Matcher (java.util.regex.Matcher)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1