001/*-
002 *******************************************************************************
003 * Copyright (c) 2011, 2016 Diamond Light Source Ltd.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *    Peter Chang - initial API and implementation and/or initial documentation
011 *******************************************************************************/
012
013package org.eclipse.january;
014
015/**
016 * Interface to monitoring loading of files, which may take a while.
017 */
018public interface IMonitor {
019
020        /**
021         * @param amount
022         */
023        public void worked(int amount);
024        
025        /**
026         * @return true if user cancelled loading.
027         */
028        public boolean isCancelled();
029        
030        /**
031         * Starts a subtask.
032         * 
033         * @param taskName
034         */
035        public void subTask(String taskName);
036        
037        public class Stub implements IMonitor {
038
039                @Override
040                public void worked(int amount) {
041                        
042                }
043
044                @Override
045                public boolean isCancelled() {
046                        return false;
047                }
048
049                @Override
050                public void subTask(String taskName) {
051                        // nothing
052                }
053                
054        }
055}