use of net.heartsome.cat.ts.core.file.XLFHandler in project translationstudio8 by heartsome.
the class MatchViewPart method manualExecSimpleTranslation.
public void manualExecSimpleTranslation(int rowIndex, IXliffEditor editor, ISimpleMatcher simpleMatcher) {
if (rowIndex == -1) {
return;
}
// handler.getTransUnit(rowId);
TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);
if (transUnit == null) {
return;
}
XLFHandler handler = editor.getXLFHandler();
if (handler == null) {
return;
}
IProject prj = null;
if (editor instanceof IEditorPart) {
IEditorPart p = (IEditorPart) editor;
FileEditorInput input = (FileEditorInput) p.getEditorInput();
prj = input.getFile().getProject();
}
if (prj == null) {
return;
}
String rowId = handler.getRowId(rowIndex);
TransUnitInfo2TranslationBean tuInfo = getTuInfoBean(transUnit, handler, rowId);
TranslationTaskData data = new TranslationTaskData(simpleMatcher, transUnit, tuInfo, editor, rowIndex, prj);
synchronized (manualTranslationTaskContainer) {
manualTranslationTaskContainer.pushTranslationTask(data);
manualTranslationTaskContainer.notify();
}
}
use of net.heartsome.cat.ts.core.file.XLFHandler in project translationstudio8 by heartsome.
the class MatchViewPart method manualExecComplexTranslation.
public void manualExecComplexTranslation(int rowIndex, IXliffEditor editor, IComplexMatch complexMatcher) {
if (rowIndex == -1) {
return;
}
// handler.getTransUnit(rowId);
TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);
if (transUnit == null) {
return;
}
XLFHandler handler = editor.getXLFHandler();
if (handler == null) {
return;
}
IProject prj = null;
if (editor instanceof IEditorPart) {
IEditorPart p = (IEditorPart) editor;
FileEditorInput input = (FileEditorInput) p.getEditorInput();
prj = input.getFile().getProject();
}
if (prj == null) {
return;
}
String rowId = handler.getRowId(rowIndex);
TransUnitInfo2TranslationBean tuInfo = getTuInfoBean(transUnit, handler, rowId);
TranslationTaskData data = new TranslationTaskData(complexMatcher, transUnit, tuInfo, editor, rowIndex, prj);
synchronized (manualTranslationTaskContainer) {
manualTranslationTaskContainer.pushTranslationTask(data);
manualTranslationTaskContainer.notify();
}
}
use of net.heartsome.cat.ts.core.file.XLFHandler in project translationstudio8 by heartsome.
the class ReverseConversionWizardPage method getTgtEncoding.
/**
* 取得目标文件的编码
* @param xliffPath
* @return ;
*/
private String getTgtEncoding(String xliffPath) {
XLFHandler handler = new XLFHandler();
Map<String, Object> resultMap = handler.openFile(xliffPath);
if (resultMap == null || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) {
//$NON-NLS-1$
return "";
}
List<HashMap<String, String>> documentInfo = handler.getDocumentInfo(xliffPath);
if (documentInfo.size() > 0) {
return documentInfo.get(0).get(DocumentPropertiesKeys.ENCODING);
}
return "";
}
Aggregations