Bug 517379 - [CheatSheet] how to extend current implementation, use Cheatsheet as API, most of methods are not public
Summary: [CheatSheet] how to extend current implementation, use Cheatsheet as API, mos...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.8 M1   Edit
Assignee: smaoui asma CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2017-05-29 10:24 EDT by smaoui asma CLA
Modified: 2017-06-27 04:53 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description smaoui asma CLA 2017-05-29 10:24:56 EDT
Hello,
 
I am working with Papyrus team https://eclipse.org/papyrus/ and we found that the Eclipse Cheat Sheet plugin offer really a good way to provide interactive tutorials about our tool.
 
However, we noticed that the current implementation is not easily extended, nor always accessible from outside the org.eclipse.ui.cheatsheets plugin (most of methods and attributes are not public).
 
In fact, we aim to enhance in some cases the current behavior of the Cheatsheet view.
For example, when a Cheatsheet task open a wizard and list the sub tasks to be performed each time we move from one wizard page to another, the sub tasks are not automatically set to complete , the user has to set it manually to complete, to be able to move to the following task.
https://www.eclipse.org/forums/index.php/m/1764053/?srch=cheatsheet#msg_1764053
 
To do so, we have to access the CheatsheetViewer attribute associated to the CheatsheatPart but this attribute is private as well as the advanceItem(…) method that allow to mark the task as completed. 
 
So, we are wondering what is the best way to use the Cheatsheet plugin as an API ? 
 
Thank you very much for your help.
Comment 1 Dani Megert CLA 2017-06-16 10:37:37 EDT
(In reply to smaoui asma from comment #0)
> To do so, we have to access the CheatsheetViewer attribute associated to the
> CheatsheatPart

That class does not exist in the Eclipse SDK.
Comment 2 smaoui asma CLA 2017-06-16 10:45:15 EDT
The java class is named "CheatSheetHelpPart" (the cheatsheet view displayed in the wizard as help part)
the viewer is private: "private CheatSheetViewer viewer;"

The same thing for CheatSheetViewer->advanceItem(ImageHyperlink link, boolean markAsCompleted) the method is not public 

Asma
Comment 3 Dani Megert CLA 2017-06-16 11:07:05 EDT
(In reply to smaoui asma from comment #2)
> The java class is named "CheatSheetHelpPart" (the cheatsheet view displayed
> in the wizard as help part)

That class is not API as well.

Only what's in the 'org.eclipse.ui.cheatsheets' is currently API.

You would have to find out what you need as API and ask here whether we think that's a good idea. After that you could provide a Gerrit change for that.

On our team no one has time to add APIs at the moment.
Comment 4 smaoui asma CLA 2017-06-19 07:51:38 EDT
OK that's fine.

So, for the use case that I descrtibed in the Description of this bug (set as complete the sub task of a CheatSheetHelpPart when the user hint the Next button in the associated wizard), I need to set to public alll of these:

- CheatSheetHelpPart.viewer

- CheatSheetViewer.advanceSubItem(ImageHyperlink link, boolean markAsCompleted, int subItemIndex)

- CheatSheetViewer.saveCurrentSheet()

- SubItemCompositeHolder.setCompleted(boolean isCompleted)

but for other use cases, I may need to set also to public 

- CheatSheetViewer.advanceItem(ImageHyperlink link, boolean markAsCompleted)
- ViewItem.setExpanded() 
- ViewItem.setComplete()...

Let me know if it makes sense to change the accessibility of thoses methods/attributes so that I can propose a gerrit for that.

Asma
Comment 5 Dani Megert CLA 2017-06-19 08:07:09 EDT
(In reply to smaoui asma from comment #4)
> Let me know if it makes sense to change the accessibility of thoses
> methods/attributes so that I can propose a gerrit for that.

Crafting an API is not just making something public. You need to make sure that the API makes sense, is adopted by clients and works in the future. I doubt that this is the case with the mentioned members. They were never designed to be API.
Comment 6 smaoui asma CLA 2017-06-19 10:09:38 EDT
why this can not make sense ? it is just about allowing  the user to set an item as complete and save its cheatSheetHelpPart.

Actually when the user open a wizard, the cheatsheet is displayed in the wizard as a helpPart but it did not follow the wizard change page. 

What does not make sense is to have a an incomplete task while the user has complete it. the sychronization between the wizard page and the cheatsheet task is needed for us and we are not the only users that aks for this kind of sychro 
https://www.eclipse.org/forums/index.php/m/1764053/?srch=cheatsheet#msg_1764053

we can only ensure this if we have access to advanceSubItem() and the other methods listed in my last comment.

Besides, I can notice that advanceIntroItem() is actually public whether advanceSubItem() is not ! and both in the same class and called only by classes of the same plugins.
Comment 7 Dani Megert CLA 2017-06-19 12:04:50 EDT
(In reply to smaoui asma from comment #6)
> why this can not make sense ? 

Because APIs need to be designed. Just changing visibility of members isn't that.
Comment 8 smaoui asma CLA 2017-06-20 04:48:07 EDT
OK, so what do you suggest to be able to sychronize the cheatsheet sub item with the wizard without calling the method advanceSubItem() and saveCurrentSheet() ?

My end purpose it to have acces to these methods.

and I do not understand why CheatSheetViewer.advanceIntroItem() is public ? and it is not possible to make CheatSheetViewer.advanceSubItem() public ?

Thanks

Asma
Comment 9 Dani Megert CLA 2017-06-20 04:55:38 EDT
(In reply to smaoui asma from comment #8)
> OK, so what do you suggest to be able to sychronize the cheatsheet sub item
> with the wizard without calling the method advanceSubItem() and
> saveCurrentSheet() ?
> 
> My end purpose it to have acces to these methods.
> 
> and I do not understand why CheatSheetViewer.advanceIntroItem() is public ?
> and it is not possible to make CheatSheetViewer.advanceSubItem() public ?
> 
> Thanks
> 
> Asma

CheatSheetViewer is also not API it is an internal class that you use at your own risk. Now, if you are comfortable with that, we can open up those methods, but that does not mean they are API.
Comment 10 smaoui asma CLA 2017-06-20 06:33:38 EDT
OK, that will be fine.

Thanks 

Asma
Comment 11 Dani Megert CLA 2017-06-20 09:45:31 EDT
(In reply to smaoui asma from comment #10)
> OK, that will be fine.
> 
> Thanks 
> 
> Asma

OK. Please provide the Gerrit change.
Comment 12 Eclipse Genie CLA 2017-06-21 05:34:36 EDT
New Gerrit change created: https://git.eclipse.org/r/99734