use of net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil in project translationstudio8 by heartsome.
the class NeedReviewSegmentHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
XLFHandler handler = xliffEditor.getXLFHandler();
List<String> selectedRowIds = xliffEditor.getSelectedRowIds();
boolean isNeedReview = true;
//先判断所有的选择文本段的是否锁定状态
for (String rowId : selectedRowIds) {
if (!handler.isNeedReview(rowId)) {
isNeedReview = false;
break;
}
}
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.changIsQuestionState(selectedRowIds, isNeedReview ? "no" : "yes");
}
return null;
}
use of net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil in project translationstudio8 by heartsome.
the class MergeSegmentHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.mergeSegment();
return null;
}
use of net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil in project translationstudio8 by heartsome.
the class ExecuteFuzzyTranslationHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IEditorPart editor = window.getActivePage().getActiveEditor();
if (!XLIFF_EDITOR_ID.equals(editor.getSite().getId())) {
return null;
}
final XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) editor;
final NattableUtil util = NattableUtil.getInstance(nattable);
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// monitor.beginTask(Messages.getString("translation.ExecuteFuzzyTranslationHandler.task1"), 8);
// 首选获取有译文的trans-unit
monitor.beginTask(Messages.getString("translation.ExecuteFuzzyTranslationHandler.task2"), 10);
XLFHandler handler = nattable.getXLFHandler();
Map<String, List<String>> rowIdMap = new HashMap<String, List<String>>();
rowIdMap = RepeatRowSearcher.getRepeateRowsForFuzzy(handler);
monitor.worked(1);
util.propagateTranslations(rowIdMap, monitor);
monitor.done();
}
};
try {
new ProgressMonitorDialog(nattable.getEditorSite().getShell()).run(true, true, runnable);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
nattable.autoResize();
return null;
}
Aggregations