001    /**
002     * <copyright>
003     *
004     * Copyright (c) 2005 IBM Corporation and others.
005     * All rights reserved.   This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     *
010     * Contributors:
011     *   IBM - Initial API and implementation
012     *
013     * </copyright>
014     *
015     * $Id: Monitor.java,v 1.1 2005/11/18 12:00:57 emerks Exp $
016     */
017    package org.eclipse.emf.common.util;
018    
019    
020    /**
021     * An task monitor that provides control and feedback.
022     */
023    public interface Monitor 
024    {
025      /**
026       * Returns whether the activity has been canceled.
027       */
028      boolean isCanceled();
029      
030      /**
031       * Sets whether the active should be canceled.
032       */
033      void setCanceled(boolean value);
034      
035      /**
036       * Sets the reason for the activity being blocked.
037       */
038      void setBlocked(Diagnostic reason);
039      
040      /**
041       * Clears the reason for the activity being blocked.
042       */
043      void clearBlocked();
044    
045      /**
046       * Represents an unknown amount or work.
047       */
048      int UNKNOWN = -1;
049      
050      /**
051       * Called once per instance to indicate the name of the task and its expected duration.
052       */
053      void beginTask(String name, int totalWork);
054      
055      /**
056       * Update the task name.
057       */
058      void setTaskName(String name);
059      
060      /**
061       * Sets the current subtask of the overall task.
062       */
063      void subTask(String name);
064    
065      /**
066       * Called to indicate the amount or progress on the task.
067       */
068      void worked(int work);
069      
070      /**
071       * Called by subprogress monitors to do fractional work.
072       */
073      void internalWorked(double work);
074        
075      /**
076       * Called to indicate the task is complete.
077       *
078       */
079      void done();
080    }
081