Skip to main content
summaryrefslogtreecommitdiffstats
blob: f5fa77ed9c3c044d1d71f8b73e6d00a5308aba65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2003, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - Initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.server.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/**
 * This interface represents a task that can be executed (and then possibly
 * undone). To tie together multiple tasks, a common task model can be used
 * to pass parameters to the task or have the output of one task feed into
 * another task.
 * 
 * <p>This interface is not intended to be implemented by clients.</p>
 * 
 * @since 1.0
 */
public interface ITask {
	/**
	 * Returns the label for this command.
	 *
	 * @return java.lang.String
	 */
	public String getName();

	/**
	 * Returns a description of this command.
	 *
	 * @return java.lang.String
	 */
	public String getDescription();

	/**
	 * Return the task model.
	 * 
	 * @return the task model
	 */
	public ITaskModel getTaskModel();

	/**
	 * Set the task model.
	 * 
	 * @param taskModel the task model
	 */
	public void setTaskModel(ITaskModel taskModel);

	/**
	 * Returns whether the task can be executed.
	 * 
	 * @return <code>true</code> if the task can be executed, and 
	 *    <code>false</code> otherwise
	 */
	public boolean canExecute();

	/**
	 * Execute (perform) the task.
	 * 
	 * @param monitor
	 * @throws CoreException
	 */
	public void execute(IProgressMonitor monitor) throws CoreException;

	/**
	 * Returns whether the task can be undone.
	 * 
	 * @return <code>true</code> if the task can be undone, and 
	 *    <code>false</code> otherwise
	 */
	public boolean canUndo();
	
	/**
	 * Undo the task.
	 */
	public void undo();
}

Back to the top