Skip to main content
summaryrefslogtreecommitdiffstats
blob: ebd686700b035d9c0a603f453b52b53b01d8ef89 (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
/*******************************************************************************
 * Copyright (c) 2004, 2006 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.util.Set;

/**
 * Manages the running of a cheat sheet.
 * <p>
 * Each cheat sheet that is opened in the UI is assigned its own cheat sheet
 * manager, which stays with it until the cheat sheet is completed (or
 * restarted). The cheat sheet manager is passed as a parameter to cheat
 * sheet-aware actions which implement {@link ICheatSheetAction}. The manager
 * carries arbitrary key-value data (strings) for the lifetime of a cheat sheet,
 * and can be accessed via {@link #getData(String)}and
 * {@link #setData(String, String)}. If the workbench is shut down while the
 * cheat sheet is in progress, this data will generally be saved and later
 * restored when the workbench is restarted and cheat sheet is resumed. The
 * manager also supports a {@link CheatSheetListener}(specified via the
 * "listener" attribute of the "cheatsheet" element in the cheat sheet content
 * file), which is kept informed of life cycle events over the course of the
 * cheat sheet's life time.
 * </p>
 * 
 * @since 3.0
 * @noimplement This interface is not intended to be implemented by clients.
 * @noextend This interface is not intended to be extended by clients.
 */
public interface ICheatSheetManager {

	/**
	 * Returns the id of the cheat sheet managed by this manager.
	 * 
	 * @return the cheat sheet id
	 */
	public String getCheatSheetID();

	/**
	 * Returns the data value associated with the given key.
	 * 
	 * @param key the key
	 * @return the string data associated with the key, or
	 * <code>null</code> none
	 * @exception IllegalArgumentException if <code>key</code>
	 * is <code>null</code>
	 */
	public String getData(String key);

	/**
	 * Sets the data value associated with the given key.
	 * <p>
	 * Data associated with a cheat sheet manager is remembered
	 * for the life of the manager. All data is discarded when 
	 * the cheat sheet is completed (or restarted).
	 * </p>
	 * 
	 * @param key the key
	 * @param data the string data associated with the key,
	 * or <code>null</code> to remove
	 * @exception IllegalArgumentException if <code>key</code>
	 * is <code>null</code>
	 */
	public void setData(String key, String data);
	
	/**
	 * Get the cheat sheet manager for the enclosing composite cheat sheet.
	 * @return The cheat sheet manager for the composite cheat sheet which contains
	 * this cheat sheet as a task or <code>null</code> if this cheatsheet was not
	 * opened as a subtask of a composite cheat sheet.
	 * @since 3.2
	 */
	public ICheatSheetManager getParent();
	
	/**
	 * Get the keys for the data in this cheat sheet manager
	 * @return The set of keys.
	 * @since 3.2
	 */
	public Set getKeySet();
}

Back to the top