Bug 84457 - [CheatSheet] No API to restart the cheat sheet
Summary: [CheatSheet] No API to restart the cheat sheet
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Chris Goldthorpe CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2005-02-04 13:28 EST by David Michonneau CLA
Modified: 2006-03-10 17:52 EST (History)
3 users (show)

See Also:


Attachments
Patch including API, implementation and JUnits (40.10 KB, patch)
2006-03-07 16:43 EST, Chris Goldthorpe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Michonneau CLA 2005-02-04 13:28:35 EST
The CheatSheet API gives no way to restart/reinitialize the cheat sheet. This 
is a problem when the cheat sheet is opened programmatically and must appear 
in its initial state. In the current behaviour opening a cheat sheet always 
restores the cheat sheet last state, and there is no way to restart it 
programmatically.
Comment 1 James Stuckey CLA 2006-02-21 12:59:30 EST
+1 for being able to programmatically restart a cheat sheet.  This is a major issue if you want to be able to utilize a cheat sheet to assist with a recurring activity.  Forcing the user to manually restart the next time they need guidance from the cheat sheet provides a poor user experience.

Along these same lines it might be nice if one could not only restart the cheat sheet but also provide a cheat sheet manager which is pre-initialized with some values used in the cheat sheet (null could be passed for the trivial restart case).  This would allow for seeding the cheat sheet with values for cases where the context might allow you to provide intelligent default data.  
Comment 2 Chris Goldthorpe CLA 2006-03-02 16:08:25 EST
We should implement this for 3.2 M6 and allow the cheat sheet data to be pre-initialized. At the same time we should add a function to get the key set for a cheat sheet manager, this would be very useful for composite cheat sheets.

Since ICheatSheetManager is marked with

* <p>
* This interface is not intended to be implemented by clients.
* </p>

This is a non-breaking change.

Below are the two new functions I propose adding to org.eclipse.ui.cheatsheets.ICheatSheetManager.

/**
 * 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();
}
Comment 3 Chris Goldthorpe CLA 2006-03-02 16:16:44 EST
I forgot to include the API change that is central to this defect - this is the function to be added to org.eclipse.ui.cheatsheets.ICheatSheetViewer to perform the restart.

This is also a non-breaking change.

 * <p>
 * This interface is not intended to be implemented by clients.
 * </p>

Here's the new function:

/**
 * Sets the currently active cheat sheet to its initial state and set
 * the cheat sheet manager data.
 * @param cheatSheetData A map whose keys and values are all of type
 * <code>java.lang.String</code> or <code>null</code> to reset all data in 
 * the cheat sheet manager. 
 */
public void reset(Map cheatSheetData);
Comment 4 John Arthorne CLA 2006-03-06 10:34:16 EST
Even non-breaking API additions need to be approved by the PMC at this stage. CCing McQ.
Comment 5 Curtis d'Entremont CLA 2006-03-06 11:34:30 EST
Tentatively setting target to M6 (awaiting PMC approval).
Comment 6 Mike Wilson CLA 2006-03-07 11:01:54 EST
John is correct, in that all API changes need to be approved. In particular, one of the purposes of the API freeze is to ensure that other projects that depend on us can understand what they are getting early enough to be able to make use of it. If our contracts change in interesting ways (such as being able to reset cheat sheets programatically) it could significantly influence how their workflows are implemented, and if this was a feature that they really wanted, but couldn't use because it was too late in the cycle, they would be pissed.

+1 to this particular change, ok to proceed, but we really need to push towards making these things happen earlier in the cycle.
Comment 7 Chris Goldthorpe CLA 2006-03-07 16:43:41 EST
Created attachment 35860 [details]
Patch including API, implementation and JUnits

Thanks for the approval, here's the patch.
Comment 8 Curtis d'Entremont CLA 2006-03-08 11:38:49 EST
Applied.