use of net.heartsome.cat.common.locale.Language in project translationstudio8 by heartsome.
the class LanguageCodesPreferencePage method refreshFormatControls.
/**
* 根据当前选择的语言,更新数字、货币等的显示示例
* @param selection
* ;
*/
protected void refreshFormatControls(IStructuredSelection selection) {
Object firstSelected = selection.getFirstElement();
if (firstSelected instanceof Language) {
Language language = (Language) firstSelected;
digitalValue.setText(language.getName());
digitalValue.setToolTipText(language.getName());
currencyValue.setText(language.getName());
currencyValue.setToolTipText(language.getName());
timeValue.setText(language.getName());
timeValue.setToolTipText(language.getName());
shortDateValue.setText(language.getName());
shortDateValue.setToolTipText(language.getName());
longDateValue.setText(language.getName());
longDateValue.setToolTipText(language.getName());
}
}
use of net.heartsome.cat.common.locale.Language in project translationstudio8 by heartsome.
the class LanguageCodesPreferencePage method verifyCurrentSelected.
// 验证当前的选择是否合法,如果合法,根据操作类型进行后续的操作
protected void verifyCurrentSelected(int operateType) {
ISelection selection = fFilteredTree.getViewer().getSelection();
if (selection.isEmpty()) {
String messagePattern = Messages.getString("languagecode.LanguageCodesPreferencePage.msg1");
Object[] values = new String[0];
if (operateType == EDIT) {
values = new String[] { Messages.getString("languagecode.LanguageCodesPreferencePage.msg2") };
} else if (operateType == REMOVE) {
values = new String[] { Messages.getString("languagecode.LanguageCodesPreferencePage.msg3") };
}
String message = MessageFormat.format(messagePattern, values);
MessageDialog.openInformation(fFilteredTree.getShell(), Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), message);
return;
} else if (operateType == EDIT && fFilteredTree.getViewer().getTree().getSelectionCount() > 1) {
MessageDialog.openInformation(fFilteredTree.getShell(), Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), Messages.getString("languagecode.LanguageCodesPreferencePage.msg4"));
return;
}
if (selection instanceof IStructuredSelection) {
IStructuredSelection iStructuredSelection = (IStructuredSelection) selection;
Object object = iStructuredSelection.getFirstElement();
if (object instanceof Language) {
if (operateType == EDIT) {
Language language = (Language) object;
editLanguage(language);
} else if (operateType == REMOVE) {
// 删除所选择的语言
if (MessageDialog.openConfirm(fFilteredTree.getShell(), Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), Messages.getString("languagecode.LanguageCodesPreferencePage.msg5"))) {
removeLanguage(iStructuredSelection.toList());
}
}
}
}
}
use of net.heartsome.cat.common.locale.Language in project translationstudio8 by heartsome.
the class ProjectSettingBaseInfoPage method initData.
/**
* 初始化界面数据 ;
*/
private void initData() {
projectNameLabel.setText(this.projCfgBean.getProjectName().replaceAll("&", "&&"));
sourceLangLabel.setText(this.projCfgBean.getSourceLang().getName());
List<Language> targetLangs = this.projCfgBean.getTargetLang();
StringBuffer targetlang = new StringBuffer();
for (int i = 0; i < targetLangs.size(); i++) {
targetlang.append(targetLangs.get(i).getName()).append(",");
}
String tLangs = targetlang.toString();
targetlangLabel.setText(tLangs.substring(0, tLangs.length() - 1));
}
use of net.heartsome.cat.common.locale.Language in project translationstudio8 by heartsome.
the class NewProjectWizardLanguagePage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout(1, false));
// source language control
Group sourceLanguageGrp = new Group(container, SWT.NONE);
sourceLanguageGrp.setLayout(new GridLayout(1, false));
sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
sourceLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.sourceLanguageGrp"));
srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
TableCombo tableCombo = srcLangComboViewer.getTableCombo();
// set options.
tableCombo.setShowTableLines(false);
tableCombo.setShowTableHeader(false);
tableCombo.setDisplayColumnIndex(-1);
tableCombo.setShowImageWithinSelection(true);
tableCombo.setShowColorWithinSelection(false);
tableCombo.setShowFontWithinSelection(false);
tableCombo.setVisibleItemCount(20);
srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
srcLangComboViewer.setContentProvider(new ArrayContentProvider());
srcLangComboViewer.setInput(languages);
srcLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
srcLanguage = (Language) selection.getFirstElement();
validator.update();
}
});
// initialization remember value
String rmSrcLangCode = ps.getString(IPreferenceConstants.NEW_PROJECT_SRC_LANG);
if (rmSrcLangCode != null && !rmSrcLangCode.equals("")) {
for (Language srcLang : languages) {
if (srcLang.getCode().equals(rmSrcLangCode)) {
srcLangComboViewer.setSelection(new StructuredSelection(srcLang));
break;
}
}
}
// end source language
// target language control
Group targetLanguageGrp = new Group(container, SWT.NONE);
targetLanguageGrp.setLayout(new GridLayout(3, false));
targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
targetLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.targetLanguageGrp"));
targetLangControl.createControl(targetLanguageGrp);
// end Target language
setControl(container);
validator.update();
}
use of net.heartsome.cat.common.locale.Language in project translationstudio8 by heartsome.
the class ProjectSettingLanguagePage method validator.
/**
* 输入验证器
* @return ;
*/
public boolean validator() {
if (projCfgBean.getTargetLang().size() == 0) {
MessageDialog.openError(getShell(), Messages.getString("projectsetting.ProjectSettingLanguagePage.msgTitle"), Messages.getString("projectsetting.ProjectSettingLanguagePage.msg1"));
return false;
}
String srcCode = projCfgBean.getSourceLang().getCode();
List<Language> target = projCfgBean.getTargetLang();
for (Language tLang : target) {
String tCode = tLang.getCode();
if (tCode.equals(srcCode)) {
MessageDialog.openError(getShell(), Messages.getString("projectsetting.ProjectSettingLanguagePage.msgTitle"), Messages.getString("projectsetting.ProjectSettingLanguagePage.msg2"));
return false;
}
}
return true;
}
Aggregations