1 /*******************************************************************************
\r
2 * Copyright (c) 2016 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * Semantum Oy - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.layer0.util;
\r
14 import org.eclipse.core.runtime.IProgressMonitor;
\r
15 import org.simantics.graph.db.TGStatusMonitor;
\r
18 * @author Tuukka Lehtonen
\r
19 * @since 1.22.1 & 1.24.0
\r
21 public class TGProgressMonitor implements TGStatusMonitor {
\r
23 protected final IProgressMonitor monitor;
\r
24 private int lastPercentage = 0;
\r
26 public TGProgressMonitor(IProgressMonitor monitor) {
\r
27 this.monitor = monitor;
\r
31 public void status(int percentage) {
\r
32 if (percentage > lastPercentage) {
\r
33 monitor.worked(percentage - lastPercentage);
\r
34 workDone(percentage);
\r
35 lastPercentage = percentage;
\r
40 public boolean isCanceled() {
\r
41 return monitor.isCanceled();
\r
44 protected void workDone(int percentage) {
\r