Search in sources :

Example 6 with UpdateDataBean

use of net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean in project translationstudio8 by heartsome.

the class XLIFFEditorImplWithNatTable method affterFuzzyMatchApplayTarget.

/**
	 * (non-Javadoc)
	 * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#affterFuzzyMatchApplayTarget(int, String, String, String)
	 */
public void affterFuzzyMatchApplayTarget(int rowIndex, String targetContent, String matchType, String quality) {
    StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor();
    if (cellEditor != null && cellEditor.getRowIndex() == rowIndex) {
        String currentText = cellEditor.getSegmentViewer().getText();
        if (currentText == null || currentText.trim().equals("")) {
            UpdateDataBean bean = new UpdateDataBean(targetContent, matchType, quality);
            cellEditor.setCanonicalValue(bean);
        }
    }
}
Also used : UpdateDataBean(net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean)

Example 7 with UpdateDataBean

use of net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean in project translationstudio8 by heartsome.

the class StyledTextCellEditor method activateCell.

protected Control activateCell(final Composite parent, HsMultiCellEditor hsCellEditor) {
    this.hsCellEditor = hsCellEditor;
    StyledText text = createTextControl(parent);
    text.setBounds(hsCellEditor.getEditorBounds());
    // analyzeCellType(); // 分析单元格类型。
    this.cellType = hsCellEditor.getType();
    if (cellType == NatTableConstant.TARGET) {
        this.source = HsMultiActiveCellEditor.getSourceEditor().getOriginalCanonicalValue().toString();
        // 设置原文本,用来解析内部标记
        viewer.setSource(source);
    }
    // 判断“可编辑”状态;
    editableManager.judgeEditable();
    // If we have an initial value, then
    Object originalCanonicalValue = this.hsCellEditor.getOriginalCanonicalValue();
    if (originalCanonicalValue != null) {
        setCanonicalValue(new UpdateDataBean(originalCanonicalValue.toString(), null, null));
    } else {
        setCanonicalValue(new UpdateDataBean());
    }
    // 改变关闭状态标识
    close = false;
    xliffEditor.getTable().addDisposeListener(this);
    // text.forceFocus();
    // 初始化撤销/重做管理器,设置步长为 50。
    viewer.initUndoManager(50);
    // 绑定全局 Edit 菜单
    actionHandler.addTextViewer(viewer);
    text.addKeyListener(movedKeyListener);
    // 移除向上和向下键默认事件处理,将此部分实现放到upAndDownKeyListener监听中
    text.setKeyBinding(SWT.ARROW_DOWN, SWT.NULL);
    text.setKeyBinding(SWT.ARROW_UP, SWT.NULL);
    addMouselistener(text);
    return text;
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) UpdateDataBean(net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean)

Aggregations

UpdateDataBean (net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean)7 AutoResizeCurrentRowsCommand (net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommand)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)1 ISegmentViewer (net.heartsome.cat.ts.ui.innertag.ISegmentViewer)1 StyledTextCellEditor (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor)1 CellVisualChangeEvent (net.sourceforge.nattable.layer.event.CellVisualChangeEvent)1 SelectCellCommand (net.sourceforge.nattable.selection.command.SelectCellCommand)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)1 StyledText (org.eclipse.swt.custom.StyledText)1 Point (org.eclipse.swt.graphics.Point)1