use of org.eclipse.mylyn.internal.wikitext.ui.editor.actions.ContextHelpAction in project mylyn.docs by eclipse.
the class ShowCheatSheetCommand method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
// $NON-NLS-1$
Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
if (activeFocusControl instanceof Control) {
Control control = (Control) activeFocusControl;
MarkupLanguage markupLanguage = (MarkupLanguage) control.getData(MarkupLanguage.class.getName());
ISourceViewer viewer = (ISourceViewer) control.getData(ISourceViewer.class.getName());
if (markupLanguage != null && viewer != null) {
ToolBarManager toolBarManager = new ToolBarManager();
toolBarManager.add(new ContextHelpAction());
final InformationPresenter informationPresenter = InformationPresenterUtil.getHtmlInformationPresenter(viewer, new InformationPresenterUtil.SizeConstraint(50, 200, true, true), toolBarManager, computeCheatSheet(markupLanguage));
// show information asynchronously since on Eclipse 3.4 it will disappear otherwise
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
informationPresenter.showInformation();
}
});
}
}
return null;
}
Aggregations