Java Code Examples for org.eclipse.emf.common.util.Monitor#isCanceled()

The following examples show how to use org.eclipse.emf.common.util.Monitor#isCanceled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: M2DocValidator.java    From M2Doc with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Progresses the given amount of work on the given {@link Monitor}.
 * 
 * @param monitor
 *            the {@link Monitor}
 * @param work
 *            the amount of work
 */
private void worked(Monitor monitor, int work) {
    if (monitor.isCanceled()) {
        throw new CancellationException("Canceled by user");
    }
    monitor.worked(work);
}
 
Example 2
Source File: M2DocEvaluator.java    From M2Doc with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Progresses the given amount of work on the given {@link Monitor}.
 * 
 * @param progressMonitor
 *            the {@link Monitor}
 * @param work
 *            the amount of work
 */
private void worked(Monitor progressMonitor, int work) {
    if (progressMonitor.isCanceled()) {
        throw new CancellationException("Canceled by user");
    }
    progressMonitor.worked(work);
}
 
Example 3
Source File: M2DocUtils.java    From M2Doc with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Starts next sub task on the given {@link Monitor}.
 * 
 * @param monitor
 *            the {@link Monitor}
 * @param previousTaskDone
 *            the work done in the previous task
 * @param nextSubTaskName
 *            the next sub task name
 */
private static void nextSubTask(Monitor monitor, int previousTaskDone, String nextSubTaskName) {
    if (monitor.isCanceled()) {
        throw new CancellationException("Canceled by user");
    }
    monitor.worked(previousTaskDone);
    monitor.subTask(nextSubTaskName);
}