Search in sources :

Example 1 with StateOperation

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

the class NattableUtil method changeTgtState.

/**
	 * 改变Target的状态
	 * @param state
	 *            状态值("new", "final", "translated", "signed-off", "needs-adaptation", "needs-review-adaptation",
	 *            "needs-l10n", "needs-review-l10n", "needs-translation", "needs-review-translation");
	 */
public void changeTgtState(final List<String> selectedRowIds, final String state, IProgressMonitor monitor) {
    if (monitor == null) {
        monitor = new NullProgressMonitor();
    }
    monitor.beginTask(Messages.getString("utils.NattableUtil.task4"), 1);
    monitor.worked(1);
    final IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory();
    final IProgressMonitor monitor2 = monitor;
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            try {
                operationHistory.execute(new StateOperation("State", xliffEditor.getTable(), selectedRowIds, xliffEditor.getXLFHandler(), state), monitor2, null);
            } catch (ExecutionException e) {
                LOGGER.error("", e);
                MessageDialog.openError(xliffEditor.getSite().getShell(), Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage());
                e.printStackTrace();
            }
        }
    });
    monitor.done();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) StateOperation(net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.StateOperation) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

StateOperation (net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.StateOperation)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IOperationHistory (org.eclipse.core.commands.operations.IOperationHistory)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1