1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.sdklib.internal.repository; 18 19 /** 20 * A factory that can start and run new {@link ITask}s. 21 */ 22 public interface ITaskFactory { 23 24 /** 25 * Starts a new task with a new {@link ITaskMonitor}. 26 * 27 * @param title The title of the task, displayed in the monitor if any. 28 * @param task The task to run. 29 */ start(String title, ITask task)30 public abstract void start(String title, ITask task); 31 32 /** 33 * Starts a new task contributing to an already existing {@link ITaskMonitor}. 34 * <p/> 35 * To use this properly, you should use {@link ITaskMonitor#createSubMonitor(int)} 36 * and give the sub-monitor to the new task with the number of work units you want 37 * it to fill. The {@link #start} method will make sure to <em>fill</em> the progress 38 * when the task is completed, in case the actual task did not. 39 * 40 * @param title The title of the task, displayed in the monitor if any. 41 * @param parentMonitor The parent monitor. Can be null. 42 * @param task The task to run and have it display on the monitor. 43 */ start(String title, ITaskMonitor parentMonitor, ITask task)44 public abstract void start(String title, ITaskMonitor parentMonitor, ITask task); 45 } 46