mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Bug 291008 - [help] Register help listener for context sensitive help
This commit is contained in:
parent
b5cdb51b36
commit
e0a8f9eb3c
2 changed files with 21 additions and 4 deletions
|
@ -37,6 +37,7 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.core.runtime.content.IContentType;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.help.IContext;
|
||||
import org.eclipse.help.IContextProvider;
|
||||
import org.eclipse.jface.action.GroupMarker;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -113,6 +114,8 @@ import org.eclipse.swt.custom.BusyIndicator;
|
|||
import org.eclipse.swt.custom.ST;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.custom.VerifyKeyListener;
|
||||
import org.eclipse.swt.events.HelpEvent;
|
||||
import org.eclipse.swt.events.HelpListener;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
@ -132,6 +135,7 @@ import org.eclipse.ui.actions.ActionContext;
|
|||
import org.eclipse.ui.actions.ActionGroup;
|
||||
import org.eclipse.ui.editors.text.EditorsUI;
|
||||
import org.eclipse.ui.editors.text.TextEditor;
|
||||
import org.eclipse.ui.help.IWorkbenchHelpSystem;
|
||||
import org.eclipse.ui.ide.IGotoMarker;
|
||||
import org.eclipse.ui.navigator.ICommonMenuConstants;
|
||||
import org.eclipse.ui.part.EditorActionBarContributor;
|
||||
|
@ -2322,8 +2326,21 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
|||
public void createPartControl(Composite parent) {
|
||||
super.createPartControl(parent);
|
||||
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICHelpContextIds.CEDITOR_VIEW);
|
||||
|
||||
// bug 291008 - register custom help listener
|
||||
final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
|
||||
parent.addHelpListener(new HelpListener() {
|
||||
public void helpRequested(HelpEvent e) {
|
||||
IContextProvider provider = (IContextProvider) CEditor.this.getAdapter(IContextProvider.class);
|
||||
if (provider != null) {
|
||||
IContext context = provider.getContext(CEditor.this);
|
||||
if (context != null) {
|
||||
helpSystem.displayHelp(context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
helpSystem.displayHelp(ICHelpContextIds.CEDITOR_VIEW);
|
||||
}});
|
||||
|
||||
fEditorSelectionChangedListener = new EditorSelectionChangedListener();
|
||||
fEditorSelectionChangedListener.install(getSelectionProvider());
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ OpenDeclarations_dialog_title=Open Declaration
|
|||
OpenDeclarations_label=&Open Declaration
|
||||
OpenDeclarations_tooltip=Open an editor on the selected element's declaration
|
||||
|
||||
DefaultCEditorTextHover_html_name=<b>Name:</b>
|
||||
DefaultCEditorTextHover_html_prototype=<br><b>Prototype:</b>
|
||||
DefaultCEditorTextHover_html_name=<b>Name:</b>
|
||||
DefaultCEditorTextHover_html_prototype=<br><b>Prototype:</b>
|
||||
DefaultCEditorTextHover_html_description=<br><b>Description:</b><br>
|
||||
DefaultCEditorTextHover_html_includes=<br><b>Header files:</b><br>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue