use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method undo.
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
ExecuteResult result = executeChange(getQuery(info, RefactoringCoreMessages.Refactoring_undo_label), monitor);
if (!result.changeExecuted) {
fUndoChange = null;
fRedoChange = null;
clearActiveChange();
return createStatus(result);
}
fRedoChange = result.reverseChange;
fActiveChange = fRedoChange;
fUndoChange = null;
return Status.OK_STATUS;
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method computeUndoableStatus.
public IStatus computeUndoableStatus(IProgressMonitor monitor) throws ExecutionException {
if (fUndoChange == null)
return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoableOperation2ChangeAdapter_no_undo_available, null);
try {
if (monitor == null)
monitor = new NullProgressMonitor();
RefactoringStatus status = fUndoChange.isValid(monitor);
if (status.hasFatalError()) {
// The operation can no longer be undo.
fUndoChange = null;
clearActiveChange();
return asStatus(status);
} else {
// own dialog again inside the runnable.
return Status.OK_STATUS;
}
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method redo.
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
ExecuteResult result = executeChange(getQuery(info, RefactoringCoreMessages.Refactoring_redo_label), monitor);
if (!result.changeExecuted) {
fUndoChange = null;
fRedoChange = null;
clearActiveChange();
return createStatus(result);
}
fUndoChange = result.reverseChange;
fActiveChange = fUndoChange;
fRedoChange = null;
return Status.OK_STATUS;
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method computeRedoableStatus.
public IStatus computeRedoableStatus(IProgressMonitor monitor) throws ExecutionException {
if (fRedoChange == null)
return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoableOperation2ChangeAdapter_no_redo_available, null);
try {
if (monitor == null)
monitor = new NullProgressMonitor();
RefactoringStatus status = fRedoChange.isValid(monitor);
if (status.hasFatalError()) {
// The operation can no longer be redone.
fRedoChange = null;
clearActiveChange();
return asStatus(status);
} else {
// own dialog again inside the runnable.
return Status.OK_STATUS;
}
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException 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();
}
Aggregations