Bug 37063 - Help system hooks
Summary: Help system hooks
Status: RESOLVED WONTFIX
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.2.0 M2   Edit
Assignee: Eric Bordeau CLA
QA Contact:
URL:
Whiteboard: Bugzilla 3.4 Migration
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2003-04-29 12:57 EDT by Kim Horne CLA
Modified: 2009-08-24 12:12 EDT (History)
1 user (show)

See Also:


Attachments
Proposed GEF addition (2.13 KB, application/octet-stream)
2003-04-30 14:41 EDT, Kim Horne CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Horne CLA 2003-04-29 12:57:10 EDT
It would be nice if GEF/draw 2d could hook into the F1 help system provided by
eclipse in some way.  At minimum providing help for the currently selected tool
would be great but drilling down to individual edit parts/draw2d figures would
be even better.
Comment 1 Randy Hudson CLA 2003-04-29 15:08:05 EDT
We aren't familiar with the working of the integrated help, but we plan to 
investigate.  Any advice?
Comment 2 Kim Horne CLA 2003-04-29 15:34:58 EDT
The eclipse help system (as implemented in 2.0 - havn't looked deeply into the
latest build but it doesn't seemed to have changed too dramatically) registers
help contexts (just string identifiers) with SWT controls through static methods
on class WorkbenchHelp.  I'd suggest making a Draw2dHelp which mimics this
registry and override the F1 help activation in the LightweightSystem Canvas to
do lookups into this registry based on the IFigure with focus.  Helper methods
(setHelp()?) could then be added to AbstractGraphicaEditPart that would
associate a given help context id with whatever was returned from createFigure()
at creation time.  PaletteEntry could have similar setHelp() methods...
Comment 3 Randy Hudson CLA 2003-04-29 16:03:58 EDT
For the near future, we want to avoid making a "lightweight SWT" in draw2d.  
Are you using draw2d's focus for anything?

We would probably implement a similar approach keyed off EditParts instead of 
figures.  The help might be dependant on the model's state, which is not known 
to the figure.
Comment 4 Kim Horne CLA 2003-04-30 08:34:59 EDT
Ok.. how about this.  Add a keyHandler to the GraphicalViewer that will
intercept the F1 requests, get the EditPart with focus, get its help (or the
help of its parent should it not have its own), and display it using the eclipse
help system.  

EditPart could then provided a getHelpContext() method that returns an
org.eclipse.help.IContext appropriate to that part. setHelpContextProvider()
could be given a object that can determine the appropriate help context from the
part at hand.  A simple implementation that returns the context that maps to a
given string (like the rest of eclipse) could be provided, as well as one that
could calculate and create a custom context based on the state of the part. 

Time permitting I'd like to add a help system to our product - there are some
elements to our editor that would be a lot easier to understand with
context-sensitive help.  If this is the kind of direction you'd like to go in we
could use it as well.  The closer we can make it to something you'd like to see
done, the less work we'll need to do to change it at a later date.
Comment 5 Randy Hudson CLA 2003-04-30 10:55:06 EDT
Eric to investigate and comment.
Comment 6 Kim Horne CLA 2003-04-30 12:26:13 EDT
For what it's worth, I decided to do a little investigating into how feasable
this all was.  Three hours of "investigating" later I have it working pretty
much as I described above (for our setup - I hacked around the need to change
the Palette implementation).  I can probably package this up and show it to you
guys if you'd like.
Comment 7 Randy Hudson CLA 2003-04-30 13:43:27 EDT
Can you attach it to this bugzilla?
Comment 8 Kim Horne CLA 2003-04-30 14:41:14 EDT
Created attachment 4763 [details]
Proposed GEF addition

EditPart changes for help.  Doesn't include any changes to the Palette code to
make it easier to associate help with a palette entry.
Comment 9 Eric Bordeau CLA 2003-05-07 16:09:37 EDT
Thanks for the attachment, Kim.  We decided that the IHelpContextProvider isn't
really needed.  Instead, getAdapter will be called on AbstractGraphicalEditPart,
which will call the protected method getHelpContext().  Subclasses can override
this and call WorkbenchHelp.getHelpSupport().getContext(id) with their own
context ID.  But this won't be released until after 2.1.1.
Comment 10 Randy Hudson CLA 2003-05-08 15:37:20 EDT
to clarify, getAdapter() will be called with IContext.class as the key. I think 
you are probably safer to do help differently than we will do it in 2.2.  
Otherwise, the method signatures might be slightly different (e.g. return type 
or visibility) and you could get linking problems when 2.2 is released.

for compatibility, we will not register an editpartviewer by default with the 
help system, but we will provide your utility classes so that doing so is a one-
liner :-)
Comment 11 Kim Horne CLA 2003-05-08 15:47:27 EDT
Sounds good.  Something to keep in mind that I came across while working on 
this- when you cascade up through the SWT parts (if there is no help 
registered in your GEF parts) it's not really 'good enough' to check to see if 
a given Control has a ContextID associated with it in the eclipse help 
system.  Doing this will not catch components that have registered their own 
SWT HelpListener.  What I did was fire HelpEvents directly at the SWT 
heirarchy.  The problem with this is that there is no reliable way to 
determine if a help listener has actually been activated - I did a really 
hacky thing by looking to see if the focus had changed after firing the event, 
assuming that any help listener would interact with the UI in some way.  If 
the focus hadn't changed I fired an event at it's parent, and so on... there 
really doesnt seem to be a good solution to this problem...
Comment 12 Randy Hudson CLA 2003-05-08 15:53:01 EDT
2.2
Comment 13 Anthony Hunter CLA 2009-08-24 11:59:11 EDT
LATER and REMIND resolutions will be going away with the upgrade of Bugzilla to the latest Bugzilla 3.4.  They are no longer part of the default Bugzilla installation. See http://dev.eclipse.org/mhonarc/lists/eclipse.org-committers/msg00778.html for the announcement.

As a result 
RESOLVED + REMIND OR LATER 
will be changed to
RESOLVED + WONTFIX

This unfortunately also means I need to REOPEN and then RESOLVE as WONTFIX

Sorry for the inconvenience.
Comment 14 Anthony Hunter CLA 2009-08-24 12:12:36 EDT
LATER and REMIND resolutions will be going away with the upgrade of Bugzilla to the latest Bugzilla 3.4.  They are no longer part of the default Bugzilla installation. See http://dev.eclipse.org/mhonarc/lists/eclipse.org-committers/msg00778.html for the announcement.

As a result 
RESOLVED + REMIND OR LATER 
will be changed to
RESOLVED + WONTFIX

This unfortunately also means I need to REOPEN and then RESOLVE as WONTFIX

Sorry for the inconvenience.