Skip to main content
summaryrefslogtreecommitdiffstats
blob: 09737ca96691752c8dea2de18f6adf315bd23a37 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*******************************************************************************
 * Copyright (c) 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.ui.cheatsheets;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Dictionary;

/**
 * A task within a composite cheat sheet.
 * <p>
 * This interface is not intended to be implemented by clients.
 * </p>
 * @since 3.2
 */

public interface ICompositeCheatSheetTask {
	/**
	 * The constant that indicates that the task has not been
	 * processed yet.
	 */
	public static final int NOT_STARTED = 0;
	/**
	 * The constant that indicates that the task is in progress.
	 */
	public static final int IN_PROGRESS = 1;
	/**
	 * The constant that indicates that the task has been completed.
	 */
	public static final int COMPLETED = 2;
	/**
	 * @return the unique identifier of this task.
	 */
	public String getId();
	/**
	 * @return the translatable name of the task.
	 */
	public String getName();
	/**
	 * Returns the kind of the task editor. Tasks without
	 * editor kind are 'informational' tasks because they
	 * cannot be 'completed'. 
	 * @return task editor kind or <code>null</code> if no editor
	 * is assoticated with this task.
	 */
	public String getKind();
	/**
	 * The task parameters are used to configure the
	 * task editor with data meaningful to an editor of this kind.
	 * @return the parameter names and values as specified in the
	 * composite cheatsheet content file.
	 */
	public Dictionary getParameters();	
	/**
	 * Returns the description of the task. 
	 * @return a plain String, or XML markup that can 
	 * be understood by FormText widget.
	 * @see org.eclipse.ui.forms.widgets.FormText
	 */
	public String getDescription();
	/**
	 * Returns an array of subtasks that are children of this task.
	 * The array will be empty if this is a leaf task.
	 * @return an array of subtasks for this task
	 */
	public ICompositeCheatSheetTask [] getSubtasks();
	/**
	 * get the tasks which are required to be completed 
	 * before this task is started. 
	 * @return an array of tasks that must be completed
	 * before this task can be started.  The array will be
	 * empty if this tasks is independent of other tasks.
	 */
	public ICompositeCheatSheetTask [] getRequiredTasks();
	
	/**
	 * Get the state of this task
	 * @return NOT_STARTED, IN_PROGRESS or COMPLETED.
	 */
	public int getState();
	
	/**
	 * Returns the percentage of this task that has been 
	 * completed. 
	 * @return A task that has not been
	 * started yet has '0' as result. A task that has been
	 * completed must return '100' as a result. Anything
	 * in between represents a task in various stages of
	 * completion.
	 */
	public int getPercentageComplete();
	
	/**
	 * Set the percentage of the task that has been completed
	 * @param percentageComplete an integer between 0 and 100
	 */
	public void setPercentageComplete(int percentageComplete);
	
	/**
	 * Advance the state of this task
	 */
	public void advanceState();
	
	/**
	 * Gets the text to be displayed when this task is completed
	 * @return a plain String, or XML markup that can 
	 * be understood by FormText widget.
	 * @see org.eclipse.ui.forms.widgets.FormText
	 */
	public String getCompletionMessage();
	
	/**
	 * Determine whether this task can be started.
	 * @return true unless this task depends on a required task that has
	 * not been completed.
	 */
	public boolean isStartable();
	
	/**
	 * Gets a URL which can be used to open the content file for this 
	 * task if the content file can be specified by a path relative to
	 * the content file for the composite cheat sheet which contains it.
	 * @param path a relative path
	 * @throws MalformedURLException 
	 * @return a URL which represents a location relative to the
	 * location of the content file for the composite cheat sheet.
	 */
	public URL getInputUrl(String path) throws MalformedURLException;
	
	/**
	 * Get the enclosing composite cheat sheet
	 * @return the composite cheat sheet which contains this task
	 */
	public ICompositeCheatSheet getCompositeCheatSheet();
}

Back to the top