public static void activeSourceAndTargetCell(XLIFFEditorImplWithNatTable xliffEditor) {
    if (xliffEditor == null) {
      return;
    }
    int[] selectedRowIndexs = xliffEditor.getSelectedRows();
    if (selectedRowIndexs.length == 0) {
      return;
    }
    Arrays.sort(selectedRowIndexs);
    int rowIndex = selectedRowIndexs[selectedRowIndexs.length - 1];
    if (!xliffEditor.isHorizontalLayout()) {
      rowIndex = rowIndex * 2; // source index
    }

    NatTable natTable = xliffEditor.getTable();
    IConfigRegistry configRegistry = natTable.getConfigRegistry();
    ViewportLayer vLayer = LayerUtil.getLayer(natTable, ViewportLayer.class);
    int rowPosition = vLayer.getRowPositionByIndex(rowIndex);
    rowPosition += 1;
    if (rowPosition < 1) {
      return;
    }

    int columnIndex = xliffEditor.getSrcColumnIndex();
    HsMultiCellEditor srcCellEditor =
        activeCell(
            vLayer,
            xliffEditor,
            configRegistry,
            columnIndex,
            rowIndex,
            rowPosition,
            NatTableConstant.SOURCE);
    if (srcCellEditor == null) {
      return;
    }

    if (!xliffEditor.isHorizontalLayout()) {
      rowIndex = rowIndex + 1; // target
      rowPosition = vLayer.getRowPositionByIndex(rowIndex);
      rowPosition += 1;
      if (rowPosition < 1) {
        return;
      }
    }
    columnIndex = xliffEditor.getTgtColumnIndex();
    HsMultiCellEditor tgtCellEditor =
        activeCell(
            vLayer,
            xliffEditor,
            configRegistry,
            columnIndex,
            rowIndex,
            rowPosition,
            NatTableConstant.TARGET);
    if (tgtCellEditor == null) {
      return;
    }
    HsMultiActiveCellEditor.activateCellEditors(srcCellEditor, tgtCellEditor, natTable);

    // 目标文本段一进入焦点就进行一次拼写检查 robert 2013-01-22
    // UNDO 这里错误单词提示并没有修改颜色。
    String tgtLang = xliffEditor.getTgtColumnName();
    spellTrigger = RealTimeSpellCheckTrigger.getInstance();
    if (spellTrigger != null && spellTrigger.checkSpellAvailable(tgtLang)) {
      tgtTextFirstRealTimeSpellCheck(tgtLang, tgtCellEditor);
      tgtTextRealTimeSpellCheck(tgtLang, tgtCellEditor);
    }
    List<String> terms = xliffEditor.getTermsCache().get(selectedRowIndexs[0]);
    if (terms != null && terms.size() > 0) {
      srcCellEditor.highlightedTerms(terms);
    }
  }
  private static HsMultiCellEditor activeCell(
      ViewportLayer vLayer,
      XLIFFEditorImplWithNatTable xliffEditor,
      IConfigRegistry configRegistry,
      int columnIndex,
      int rowIndex,
      int rowPosition,
      String cellType) {
    NatTable natTable = xliffEditor.getTable();
    int columnPosition = vLayer.getColumnPositionByIndex(columnIndex);

    LayerCell cell = natTable.getCellByPosition(columnPosition, rowPosition);
    if (cell == null) {
      return null;
    }
    Rectangle cellBounds = cell.getBounds();
    List<String> configLabels = cell.getConfigLabels().getLabels();
    if (!xliffEditor.isHorizontalLayout()) {
      if (cellType.equals(NatTableConstant.SOURCE)) {
        configLabels.remove(XLIFFEditorImplWithNatTable.TARGET_EDIT_CELL_LABEL);
      } else if (cellType.equals(NatTableConstant.TARGET)) {
        configLabels.remove(XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL);
      }
    }
    ILayer layer = cell.getLayer();
    Object originalCanonicalValue = cell.getDataValue();

    IDisplayConverter displayConverter =
        configRegistry.getConfigAttribute(
            CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.EDIT, configLabels);
    IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, configLabels);
    IDataValidator dataValidator =
        configRegistry.getConfigAttribute(
            EditConfigAttributes.DATA_VALIDATOR, DisplayMode.EDIT, configLabels);

    Rectangle editorBounds =
        layer
            .getLayerPainter()
            .adjustCellBounds(
                new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height));

    int cellStartY = cellBounds.y;
    int cellEndY = cellStartY + cellBounds.height;
    Rectangle clientArea = natTable.getClientAreaProvider().getClientArea();
    int clientAreaEndY = clientArea.y + clientArea.height;
    if (cellEndY > clientAreaEndY) {
      editorBounds.height = clientAreaEndY - cellStartY;
    }

    StyledTextCellEditor cellEditor =
        (StyledTextCellEditor)
            configRegistry.getConfigAttribute(
                EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, configLabels);
    ICellEditHandler editHandler = new HsMultiCellEditorHandler(cellEditor, layer);

    HsMultiCellEditor hsCellEditor =
        new HsMultiCellEditor(
            cellType,
            cellEditor,
            editHandler,
            columnPosition,
            rowPosition,
            columnIndex,
            rowIndex,
            dataValidator,
            originalCanonicalValue,
            displayConverter,
            cellStyle,
            editorBounds);

    return hsCellEditor;
  }