use of net.heartsome.cat.ts.tm.complexMatch.IComplexMatch in project translationstudio8 by heartsome.
the class ExecuteQuickTranslation method execute.
/** (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
if (TranslateParameter.getInstance().isAutoQuickTrans()) {
return null;
}
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
final IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof IXliffEditor)) {
return null;
}
final IXliffEditor xliffEditor = (IXliffEditor) editor;
final int[] selectedRowIndexs = xliffEditor.getSelectedRows();
if (selectedRowIndexs.length == 0) {
return null;
}
// TransUnitBean transUnitBean = xliffEditor.getRowTransUnitBean(selectedRowIndexs[selectedRowIndexs.length - 1]);
IComplexMatch matcher = new QuickTranslationImpl();
// FileEditorInput input = (FileEditorInput) editor.getEditorInput();
// IProject project = input.getFile().getProject();
// List<AltTransBean> newAltTrans = matcher.executeTranslation(transUnitBean, project);
// if(newAltTrans.size() == 0){
// return null;
// }
IViewPart viewPart = window.getActivePage().findView(MatchViewPart.ID);
if (viewPart != null && viewPart instanceof MatchViewPart) {
MatchViewPart matchView = (MatchViewPart) viewPart;
matchView.manualExecComplexTranslation(selectedRowIndexs[0], xliffEditor, matcher);
// matchView.replaceMatchs(newAltTrans);
// matchView.refreshView(xliffEditor, selectedRowIndexs[selectedRowIndexs.length - 1]);
}
// }
return null;
}
use of net.heartsome.cat.ts.tm.complexMatch.IComplexMatch in project translationstudio8 by heartsome.
the class TranslationTaskContainer method pushTranslationTask.
public synchronized void pushTranslationTask(TranslationTaskData data) {
Object matcher = data.getMatcher();
if (matcher instanceof ISimpleMatcher) {
ISimpleMatcher _matcher = (ISimpleMatcher) matcher;
for (TranslationTaskData d : dataList) {
Object m = d.getMatcher();
if (m instanceof ISimpleMatcher) {
ISimpleMatcher _m = (ISimpleMatcher) m;
if (_m.getMathcerToolId().equals(_matcher.getMathcerToolId())) {
return;
}
}
}
} else if (matcher instanceof IComplexMatch) {
IComplexMatch _matcher = (IComplexMatch) matcher;
for (TranslationTaskData d : dataList) {
Object m = d.getMatcher();
if (m instanceof IComplexMatch) {
IComplexMatch _m = (IComplexMatch) m;
if (_m.getToolId().equals(_matcher.getToolId())) {
return;
}
}
}
}
dataList.add(0, data);
}
Aggregations