Can you create dynamic info pop? [message #272073] |
Mon, 20 September 2004 21:27 |
Eclipse User |
|
|
|
Originally posted by: chris_stillwell.yahoo.com
I have a TableViewer and I would like to be able to press F1 and have
information about the currently selected row displayed in an infopop type
of panel. Is this possible? If so, can anybody point me in the right
direction of where to look?
Thanks,
Chris Stillwell
|
|
|
Re: Can you create dynamic info pop? [message #272087 is a reply to message #272073] |
Tue, 21 September 2004 02:58 |
Eclipse User |
|
|
|
Originally posted by: dorian.birsan.net
"Chris Stillwell" <chris_stillwell@yahoo.com> wrote in message
news:cinhvk$i6q$1@eclipse.org...
> I have a TableViewer and I would like to be able to press F1 and have
> information about the currently selected row displayed in an infopop type
> of panel. Is this possible? If so, can anybody point me in the right
> direction of where to look?
While I haven't tried this, with some luck it should work:
call
TableViewer.addHelpListener(your_own_help_listener)
and implement your help listener to
display the infopop content in your own panel.
Take a look at PropertySheetPage to see how they implement
HelpListener.handleRequest().
-dorian
>
> Thanks,
>
> Chris Stillwell
>
|
|
|
Re: Can you create dynamic info pop? [message #272475 is a reply to message #272087] |
Wed, 22 September 2004 17:27 |
Eclipse User |
|
|
|
Originally posted by: chris_stillwell.yahoo.com
Thanks Dorian,
Here's how I implemented a solution:
private void createHelpListener()
{
viewer.getControl().addHelpListener(new HelpListener()
{
public void helpRequested(HelpEvent e)
{
IStructuredSelection selection = (IStructuredSelection)
viewer.getSelection();
if (!selection.isEmpty())
{
final MyElement element = (MyElement)
selection.getFirstElement();
TableItem[] items = viewer.getTable().getSelection();
Rectangle bounds = items[0].getBounds(0);
Point location = viewer.getControl().toDisplay(bounds.x,
bounds.y);
WorkbenchHelp.displayContext(getHelpContext(element),
location.x, location.y);
}
}
});
}
private IContext getHelpContext(final MyElement element)
{
return new IContext()
{
public IHelpResource[] getRelatedTopics()
{
return null;
}
public String getText()
{
//Build String help text for MyElement
. . .
}
};
}
|
|
|
Powered by
FUDForum. Page generated in 0.04086 seconds