Search in sources :

Example 86 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class NonTranslationQAPage method performOk.

@Override
public boolean performOk() {
    if (!isInit) {
        return true;
    }
    // 遍历列表,获取出要添加的数据
    List<NontransElementBean> addElementList = new ArrayList<NontransElementBean>();
    NontransElementBean listViewerBean;
    int listViewerNum = tableViewer.getTable().getItemCount();
    for (int i = 0; i < listViewerNum; i++) {
        if (tableViewer.getElementAt(i) instanceof NontransElementBean) {
            listViewerBean = (NontransElementBean) tableViewer.getElementAt(i);
            addElementList.add(listViewerBean);
        }
    }
    // 删除所有非译元素
    operate.deleteAllElement();
    // 再进行相关操作,先添加
    if (addElementList.size() > 0) {
        operate.addNonTransElement(addElementList);
    }
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    int oldValue = store.getInt(QAConstant.QA_PREF_nonTrans_changeTag);
    store.setValue(QAConstant.QA_PREF_nonTrans_changeTag, ++oldValue);
    return true;
}
Also used : NontransElementBean(net.heartsome.cat.ts.ui.qa.model.NontransElementBean) ArrayList(java.util.ArrayList) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Point(org.eclipse.swt.graphics.Point)

Example 87 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class QAInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    //将不包含上下文匹配的按钮设成默认选中状态
    if (isUltimate) {
        preferenceStore.setDefault(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, true);
    } else {
        preferenceStore.setDefault(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, false);
    }
    preferenceStore.setDefault(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, true);
    //将相同源文不同译文与相同译文不同源文下的忽略大小写与忽略标记全部勾选
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SAMESOURCE, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SAMETARGET, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG, true);
    //设置目标文本段长度限制检查的默认值
    preferenceStore.setDefault(QAConstant.QA_PREF_isCheckTgtMinLength, false);
    preferenceStore.setDefault(QAConstant.QA_PREF_isCheckTgtMaxLength, false);
    preferenceStore.setDefault(QAConstant.QA_PREF_tgtMinLength, "0");
    preferenceStore.setDefault(QAConstant.QA_PREF_tgtMaxLength, "0");
    //-------------------------------QAPage中的默认项--------------------
    //默认情况下所有的品质检查项全部选中,因此先将每个检查项的标识符用","组装起来。(备注:由于现在只开发了五个检查项,因此这里只加了五个,以后每开发完成一个,就加到这里)
    String defaultItems = QAConstant.QA_PARAGRAPH + "," + QAConstant.QA_NUMBER + "," + QAConstant.QA_TAG + "," + QAConstant.QA_NONTRANSLATION + "," + QAConstant.QA_SPACEOFPARACHECK + "," + QAConstant.QA_PARACOMPLETENESS + "," + QAConstant.QA_SPELL;
    String autoDefaultItems = QAConstant.QA_NUMBER + "," + QAConstant.QA_TAG + "," + QAConstant.QA_SPELL;
    //默认情况下所有的品质检查项全部选中,因此先将每个检查项的标识符用","组装起来。
    preferenceStore.setDefault(QAConstant.QA_PREF_BATCH_QAITEMS, defaultItems);
    preferenceStore.setDefault(QAConstant.QA_PREF_AUTO_QAITEMS, autoDefaultItems);
    //默认为入库时执行
    preferenceStore.setDefault(QAConstant.QA_PREF_AUTO_QARUNTIME, QAConstant.QA_FIRST);
    // 设置默认错误级别
    preferenceStore.setDefault(QAConstant.QA_PREF_term_TIPLEVEL, 1);
    preferenceStore.setDefault(QAConstant.QA_PREF_para_TIPLEVEL, 1);
    preferenceStore.setDefault(QAConstant.QA_PREF_number_TIPLEVEL, 0);
    preferenceStore.setDefault(QAConstant.QA_PREF_tag_TIPLEVEL, 0);
    preferenceStore.setDefault(QAConstant.QA_PREF_nonTrans_TIPLEVEL, 1);
    preferenceStore.setDefault(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL, 1);
    preferenceStore.setDefault(QAConstant.QA_PREF_paraComplete_TIPLEVEL, 1);
    preferenceStore.setDefault(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL, 0);
    preferenceStore.setDefault(QAConstant.QA_PREF_spell_TIPLEVEL, 1);
    //-------------------------------SpellPage 中的默认项--------------------
    preferenceStore.setDefault(QAConstant.QA_PREF_isHunspell, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_realTimeSpell, true);
    preferenceStore.setDefault(QAConstant.QA_PREF_ignoreNontrans, false);
    preferenceStore.setDefault(QAConstant.QA_PREF_ignoreDigitalFirst, false);
    preferenceStore.setDefault(QAConstant.QA_PREF_ignoreUpperCaseFirst, false);
    preferenceStore.setDefault(QAConstant.QA_PREF_ignoreAllUpperCase, true);
    //-------------------------------文件分析首选项值的初始化---------------
    preferenceStore.setDefault(QAConstant.FA_PREF_ignoreCase, true);
    preferenceStore.setDefault(QAConstant.FA_PREF_ignoreTag, true);
    if (isUltimate) {
        preferenceStore.setDefault(QAConstant.FA_PREF_contextNum, 1);
    } else {
        preferenceStore.setDefault(QAConstant.FA_PREF_contextNum, 0);
    }
    preferenceStore.setDefault(QAConstant.FA_PREF_tagPenalty, 2);
    preferenceStore.setDefault(QAConstant.FA_PREF_interRepeate, true);
    preferenceStore.setDefault(QAConstant.FA_PREF_interMatch, false);
    // 等效系数的设置,初始化值,roebrt 2011-12-21
    if (isUltimate) {
        preferenceStore.setDefault(QAConstant.FA_PREF_equivalent, "internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60;85-94:0.70;75-84:0.80;50-74:0.90;");
    } else {
        preferenceStore.setDefault(QAConstant.FA_PREF_equivalent, "internalRepeat:0.50;external100:0.50;95-99:0.60;85-94:0.70;75-84:0.80;50-74:0.90;");
    }
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 88 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class NumberOrTagConsisQAHandler method getNotIncludePara.

/**
	 * 获取首选项中品质检查的不包括的文本段
	 * @return
	 */
public Map<String, Boolean> getNotIncludePara() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    Map<String, Boolean> notInclude = new HashMap<String, Boolean>();
    // 不包括上下文匹配
    notInclude.put(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, preferenceStore.getBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE));
    // 不包括完成匹配
    notInclude.put(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, preferenceStore.getBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE));
    // 不包括已锁文本段
    notInclude.put(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, preferenceStore.getBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE));
    return notInclude;
}
Also used : HashMap(java.util.HashMap) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 89 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class ConverterPreferenceInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(Constants.PPTX_FILTER, false);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 90 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class MachineTranslationPreferenceInitializer method initializeDefaultPreferences.

/** (non-Javadoc)
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
@Override
public void initializeDefaultPreferences() {
    IPreferenceStore ps = Activator.getDefault().getPreferenceStore();
    ps.setDefault(IPreferenceConstant.GOOGLE_STATE, false);
    ps.setDefault(IPreferenceConstant.GOOGLE_KEY, "");
    ps.setDefault(IPreferenceConstant.BING_ID, "");
    ps.setDefault(IPreferenceConstant.BING_KEY, "");
    ps.setDefault(IPreferenceConstant.BING_STATE, false);
    ps.setDefault(IPreferenceConstant.ALWAYS_ACCESS, false);
    ps.setDefault(IPreferenceConstant.MANUAL_ACCESS, true);
    ps.setDefault(IPreferenceConstant.IGNORE_EXACT_MATCH, true);
    ps.setDefault(IPreferenceConstant.INGORE_LOCK, true);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)161 ArrayList (java.util.ArrayList)31 Hashtable (java.util.Hashtable)19 Before (org.junit.Before)17 List (java.util.List)14 IElementParameter (org.talend.core.model.process.IElementParameter)12 FontData (org.eclipse.swt.graphics.FontData)11 ElementParameter (org.talend.designer.core.model.components.ElementParameter)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)10 Font (org.eclipse.swt.graphics.Font)10 Composite (org.eclipse.swt.widgets.Composite)9 File (java.io.File)7 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 StyledText (org.eclipse.swt.custom.StyledText)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Point (org.eclipse.swt.graphics.Point)7 GridLayout (org.eclipse.swt.layout.GridLayout)7 Node (org.talend.designer.core.ui.editor.nodes.Node)7 GridData (org.eclipse.swt.layout.GridData)6 IOException (java.io.IOException)5