Search in sources :

Example 6 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)
	 * @param context
	 * @throws Exception
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    bundleContext = context;
    // tracker the xml converter service
    String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, Converter.DIRECTION_POSITIVE)).toString();
    positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
    positiveTracker.open();
    String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, Converter.DIRECTION_REVERSE)).toString();
    reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
    reverseTracker.open();
}
Also used : AndFilter(net.heartsome.cat.converter.util.AndFilter) ServiceTracker(org.osgi.util.tracker.ServiceTracker) Converter(net.heartsome.cat.converter.Converter) EqFilter(net.heartsome.cat.converter.util.EqFilter)

Example 7 with Converter

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

the class Activator method start.

/**
	 * (non-Javadoc).
	 * @param context
	 *            the context
	 * @throws Exception
	 *             the exception
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    // register the convert service
    Converter xml2Xliff = new Xml2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xml2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xml2Xliff.TYPE_NAME_VALUE);
    xml2XliffSR = ConverterRegister.registerPositiveConverter(context, xml2Xliff, properties);
    Converter xliff2Xml = new Xliff2Xml();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2Xml.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2Xml.TYPE_NAME_VALUE);
    xliff2XmlSR = ConverterRegister.registerReverseConverter(context, xliff2Xml, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 8 with Converter

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

the class Activator method start.

/**
	 * (non-Javadoc).
	 * @param context
	 *            the context
	 * @throws Exception
	 *             the exception
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    // register the converter services
    Converter properties2Xliff = new Properties2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, Properties2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Properties2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Properties2Xliff.TYPE_NAME_VALUE);
    properties2XliffSR = ConverterRegister.registerPositiveConverter(context, properties2Xliff, properties);
    Converter xliff2Properties = new Xliff2Properties();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2Properties.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2Properties.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2Properties.TYPE_NAME_VALUE);
    xliff2PropertiesSR = ConverterRegister.registerReverseConverter(context, xliff2Properties, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 9 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)
	 * @param context
	 * @throws Exception
	 */
public void start(BundleContext context) throws Exception {
    plugin = this;
    // register the converter services
    Converter javaScript2Xliff = new JavaScript2Xliff();
    Properties properties = new Properties();
    properties.put(Converter.ATTR_NAME, JavaScript2Xliff.NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, JavaScript2Xliff.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, JavaScript2Xliff.TYPE_NAME_VALUE);
    javaScript2XliffSR = ConverterRegister.registerPositiveConverter(context, javaScript2Xliff, properties);
    Converter xliff2JavaScript = new Xliff2JavaScript();
    properties = new Properties();
    properties.put(Converter.ATTR_NAME, Xliff2JavaScript.TYPE_NAME_VALUE);
    properties.put(Converter.ATTR_TYPE, Xliff2JavaScript.TYPE_VALUE);
    properties.put(Converter.ATTR_TYPE_NAME, Xliff2JavaScript.TYPE_NAME_VALUE);
    xliff2JavaScriptSR = ConverterRegister.registerReverseConverter(context, xliff2JavaScript, properties);
}
Also used : Converter(net.heartsome.cat.converter.Converter) Properties(java.util.Properties)

Example 10 with Converter

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

the class ConverterViewModel method convert.

@Override
public Map<String, String> convert(Map<String, String> parameters) {
    Converter converter = getConverter();
    if (converter != null) {
        System.out.println("" + converter.getName());
        try {
            converter.convert(null, null);
        } catch (ConverterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Map<String, String> result = new HashMap<String, String>(1);
        result.put("name", converter.getName());
        return result;
    }
    return null;
}
Also used : ConverterException(net.heartsome.cat.converter.ConverterException) HashMap(java.util.HashMap) Converter(net.heartsome.cat.converter.Converter)

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