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 rtf converter service
String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter(Converter.ATTR_TYPE, Rtf2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, Converter.DIRECTION_POSITIVE)).toString();
positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new RtfPositiveCustomizer());
positiveTracker.open();
String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter(Converter.ATTR_TYPE, Xliff2Rtf.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, Converter.DIRECTION_REVERSE)).toString();
reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new RtfReverseCustomize());
reverseTracker.open();
}
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 convert service
Converter text2Xliff = new Text2Xliff();
Properties properties = new Properties();
properties.put(Converter.ATTR_NAME, Text2Xliff.NAME_VALUE);
properties.put(Converter.ATTR_TYPE, Text2Xliff.TYPE_VALUE);
properties.put(Converter.ATTR_TYPE_NAME, Text2Xliff.TYPE_NAME_VALUE);
text2XliffSR = ConverterRegister.registerPositiveConverter(context, text2Xliff, properties);
Converter xliff2Text = new Xliff2Text();
properties = new Properties();
properties.put(Converter.ATTR_NAME, Xliff2Text.NAME_VALUE);
properties.put(Converter.ATTR_TYPE, Xliff2Text.TYPE_VALUE);
properties.put(Converter.ATTR_TYPE_NAME, Xliff2Text.TYPE_NAME_VALUE);
xliff2TextSR = ConverterRegister.registerReverseConverter(context, xliff2Text, properties);
}
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 rtf2Xliff = new Rtf2Xliff();
Properties properties = new Properties();
properties.put(Converter.ATTR_NAME, Rtf2Xliff.NAME_VALUE);
properties.put(Converter.ATTR_TYPE, Rtf2Xliff.TYPE_VALUE);
properties.put(Converter.ATTR_TYPE_NAME, Rtf2Xliff.TYPE_NAME_VALUE);
rtf2XliffSR = ConverterRegister.registerPositiveConverter(context, rtf2Xliff, properties);
Converter xliff2Rtf = new Xliff2Rtf();
properties = new Properties();
properties.put(Converter.ATTR_NAME, Xliff2Rtf.NAME_VALUE);
properties.put(Converter.ATTR_TYPE, Xliff2Rtf.TYPE_VALUE);
properties.put(Converter.ATTR_TYPE_NAME, Xliff2Rtf.TYPE_NAME_VALUE);
xliff2RtfSR = ConverterRegister.registerReverseConverter(context, xliff2Rtf, properties);
}
use of net.heartsome.cat.converter.Converter in project translationstudio8 by heartsome.
the class ConverterViewModel method validateXliffFile.
/**
* 验证 xliff 所需要转换的 xliff 文件
* @param xliffPath
* xliff 文件路径
* @param monitor
* @return ;
*/
public IStatus validateXliffFile(String xliffPath, XLFHandler handler, IProgressMonitor monitor) {
IStatus result = new ReverseConversionValidateWithLibrary3().validate(xliffPath, configBean, monitor);
if (!result.isOK()) {
return result;
}
// 验证是否存在 xliff 对应的源文件类型的转换器实现
String fileType = configBean.getFileType();
Converter converter = getConverter(fileType);
if (converter != null) {
// 验证 XLIFF 文件的 file 节点
result = validateFileNodeInXliff(handler, xliffPath, converter.getType());
if (!result.isOK()) {
return result;
}
result = validIsSplitedXliff(handler, xliffPath);
if (!result.isOK()) {
return result;
}
setSelectedType(fileType);
result = Status.OK_STATUS;
} else {
result = ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg3") + fileType);
}
return result;
}
Aggregations