Search in sources :

Example 16 with Converter

use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    Converter docx2Xliff = new Docx2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, Docx2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Docx2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Docx2Xliff.TYPE_NAME_VALUE);
    docx2XliffSR = ConverterRegister.registerPositiveConverter(context, docx2Xliff, properties);
    Converter xliff2Docx = new Xliff2Docx();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2Docx.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2Docx.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2Docx.TYPE_NAME_VALUE);
    xliff2DocxSR = ConverterRegister.registerReverseConverter(context, xliff2Docx, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 17 with Converter

use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.

the class ConverterTracker method getConverter.

/**
	 * 根据指定的<code>type</code>获得对应的转换器 *.
	 * @param type
	 *            指定的 type
	 * @return 返回 type 值,及初始化此 model 的转换方向的值对应的转换器。如果 type 对应的转换器不存在,则返回 <code>NULL</code>
	 */
public Converter getConverter(String type) {
    Converter converter = null;
    if (type != null & direction != null) {
        ServiceReference[] serviceReferences = converterServiceTracker.getServiceReferences();
        for (int i = 0; i < serviceReferences.length; i++) {
            String converterType = (String) serviceReferences[i].getProperty(Converter.ATTR_TYPE);
            String converterDirection = (String) serviceReferences[i].getProperty(Converter.ATTR_DIRECTION);
            if (type.equals(converterType) && direction.equals(converterDirection)) {
                converter = (Converter) converterServiceTracker.getService(serviceReferences[i]);
                break;
            }
        }
    }
    return converter;
}
Also used : Converter(net.heartsome.cat.converter.Converter) ServiceReference(org.osgi.framework.ServiceReference)

Example 18 with Converter

use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    Converter wf2Xliff = new Wf2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, Wf2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Wf2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Wf2Xliff.TYPE_NAME_VALUE);
    wf2XliffSR = ConverterRegister.registerPositiveConverter(context, wf2Xliff, properties);
    Converter xliff2Wf = new Xliff2Wf();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2Wf.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2Wf.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2Wf.TYPE_NAME_VALUE);
    xliff2WfSR = ConverterRegister.registerReverseConverter(context, xliff2Wf, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 19 with Converter

use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    Converter mq2Xliff = new Mq2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, Mq2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Mq2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Mq2Xliff.TYPE_NAME_VALUE);
    mq2XliffSR = ConverterRegister.registerPositiveConverter(context, mq2Xliff, properties);
    Converter xliff2Mq = new Xliff2Mq();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2Mq.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2Mq.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2Mq.TYPE_NAME_VALUE);
    xliff2MqSR = ConverterRegister.registerReverseConverter(context, xliff2Mq, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 20 with Converter

use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext bundleContext) throws Exception {
    super.start(bundleContext);
    Activator.context = bundleContext;
    Converter excel2xliff = new MsExcel2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, MsExcel2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, MsExcel2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, MsExcel2Xliff.TYPE_NAME_VALUE);
    excel2XLIFFSR = ConverterRegister.registerPositiveConverter(context, excel2xliff, properties);
    Converter xliff2excel = new Xliff2MsExcel();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2MsExcel.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2MsExcel.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2MsExcel.TYPE_NAME_VALUE);
    xliff2excelSR = ConverterRegister.registerReverseConverter(context, xliff2excel, properties);
    plugin = this;
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Aggregations

Converter (net.heartsome.cat.converter.Converter)29 Properties (java.util.Properties)18 AndFilter (net.heartsome.cat.converter.util.AndFilter)6 EqFilter (net.heartsome.cat.converter.util.EqFilter)6 ServiceTracker (org.osgi.util.tracker.ServiceTracker)6 ConverterException (net.heartsome.cat.converter.ConverterException)3 IStatus (org.eclipse.core.runtime.IStatus)3 File (java.io.File)2 IOException (java.io.IOException)2 ValidationStatus (org.eclipse.core.databinding.validation.ValidationStatus)2 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)2 Status (org.eclipse.core.runtime.Status)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 NavException (com.ximpleware.NavException)1 VTDException (com.ximpleware.VTDException)1 VTDGen (com.ximpleware.VTDGen)1 VTDNav (com.ximpleware.VTDNav)1 XMLModifier (com.ximpleware.XMLModifier)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1