Search in sources :

Example 11 with TransUnitBean

use of net.heartsome.cat.ts.core.bean.TransUnitBean in project translationstudio8 by heartsome.

the class MatchViewPart method reLoadMatches.

public void reLoadMatches(IXliffEditor editor, int rowIndex) {
    // 修复 Bug #3064 编辑匹配--更换记忆库后再编辑原记忆库匹配,出现异常.刷新问题
    // 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 tuInfoBean = getTuInfoBean(transUnit, handler, rowId);
    executeMatch(editor, rowId, transUnit, tuInfoBean, prj);
}
Also used : TransUnitBean(net.heartsome.cat.ts.core.bean.TransUnitBean) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) XLFHandler(net.heartsome.cat.ts.core.file.XLFHandler) IProject(org.eclipse.core.resources.IProject) TransUnitInfo2TranslationBean(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean)

Example 12 with TransUnitBean

use of net.heartsome.cat.ts.core.bean.TransUnitBean 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();
    }
}
Also used : TransUnitBean(net.heartsome.cat.ts.core.bean.TransUnitBean) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) XLFHandler(net.heartsome.cat.ts.core.file.XLFHandler) IProject(org.eclipse.core.resources.IProject) TransUnitInfo2TranslationBean(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean)

Example 13 with TransUnitBean

use of net.heartsome.cat.ts.core.bean.TransUnitBean 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();
    }
}
Also used : TransUnitBean(net.heartsome.cat.ts.core.bean.TransUnitBean) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) XLFHandler(net.heartsome.cat.ts.core.file.XLFHandler) IProject(org.eclipse.core.resources.IProject) TransUnitInfo2TranslationBean(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean)

Aggregations

TransUnitBean (net.heartsome.cat.ts.core.bean.TransUnitBean)13 IProject (org.eclipse.core.resources.IProject)5 IEditorPart (org.eclipse.ui.IEditorPart)5 FileEditorInput (org.eclipse.ui.part.FileEditorInput)5 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)4 TransUnitInfo2TranslationBean (net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean)4 Hashtable (java.util.Hashtable)3 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)3 ExecutionException (org.eclipse.core.commands.ExecutionException)3 Point (org.eclipse.swt.graphics.Point)3 AutoPilot (com.ximpleware.AutoPilot)2 NavException (com.ximpleware.NavException)2 VTDNav (com.ximpleware.VTDNav)2 XPathEvalException (com.ximpleware.XPathEvalException)2 XPathParseException (com.ximpleware.XPathParseException)2 HashMap (java.util.HashMap)2 AltTransBean (net.heartsome.cat.ts.core.bean.AltTransBean)2 VTDUtils (net.heartsome.xml.vtdimpl.VTDUtils)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 ModifyException (com.ximpleware.ModifyException)1