Search in sources :

Example 1 with UpdateDataOperation

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

the class UpdateDataAndAutoResizeCommandHandler method doCommand.

@Override
protected boolean doCommand(UpdateDataAndAutoResizeCommand command) {
    try {
        // int columnPosition = command.getColumnPosition();
        // int rowPosition = command.getRowPosition();
        // dataLayer.getDataProvider().setDataValue(columnPosition, rowPosition, command.getNewValue());
        // dataLayer.fireLayerEvent(new CellVisualChangeEvent(dataLayer, columnPosition, rowPosition));
        //
        // int currentRow = command.getRowPosition() + 1; // 修改行在当前一屏显示的几行中的相对位置
        // table.doCommand(new AutoResizeCurrentRowsCommand(table, new int[] { currentRow },
        // table.getConfigRegistry(), new GC(table)));
        IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory();
        operationHistory.execute(new UpdateDataOperation(table, dataLayer, command), null, null);
        return true;
    } catch (UnsupportedOperationException e) {
        LOGGER.error(MessageFormat.format(Messages.getString("handler.UpdateDataAndAutoResizeCommandHandler.logger1"), command.getNewValue()), e);
        e.printStackTrace(System.err);
        System.err.println("Failed to update value to: " + command.getNewValue());
    } catch (ExecutionException e) {
        LOGGER.error("", e);
        e.printStackTrace();
    }
    return false;
}
Also used : UpdateDataOperation(net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateDataOperation) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

UpdateDataOperation (net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateDataOperation)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IOperationHistory (org.eclipse.core.commands.operations.IOperationHistory)1