use of net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl 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;
}
Aggregations