Search in sources :

Example 1 with ActiveCellRegion

use of net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion in project translationstudio8 by heartsome.

the class FindReplaceDialog method doReplace.

/**
	 * 替换 ;
	 */
private void doReplace() {
    CellRegion activeCellRegion = ActiveCellRegion.getActiveCellRegion();
    if (activeCellRegion == null) {
        return;
    }
    StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor();
    if (cellEditor != null) {
        StyledText text = cellEditor.getSegmentViewer().getTextWidget();
        String sleText = text.getSelectionText();
        String findStr = cmbFind.getText();
        if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) {
            findStr = findStr.replaceAll("\\n", Constants.LINE_SEPARATOR_CHARACTER + "\n");
            findStr = findStr.replaceAll("\\t", Constants.TAB_CHARACTER + "​");
            findStr = findStr.replaceAll(" ", Constants.SPACE_CHARACTER + "​");
        }
        if (sleText != null && sleText.toLowerCase().equals(findStr.toLowerCase())) {
            Point p = text.getSelection();
            text.replaceTextRange(p.x, p.y - p.x, cmbReplace.getText());
        }
    }
}
Also used : CellRegion(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion) ActiveCellRegion(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion) StyledText(org.eclipse.swt.custom.StyledText) Point(org.eclipse.swt.graphics.Point) StyledTextCellEditor(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor)

Aggregations

StyledTextCellEditor (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor)1 ActiveCellRegion (net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion)1 CellRegion (net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion)1 StyledText (org.eclipse.swt.custom.StyledText)1 Point (org.eclipse.swt.graphics.Point)1