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