Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can you create dynamic info pop?
Can you create dynamic info pop? [message #272073] Mon, 20 September 2004 21:27 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
. . .
}
};
}
Previous Topic:How to generate a deployable plugin?
Next Topic:Drag and Drop between two trees
Goto Forum:
  


Current Time: Sat Aug 17 13:13:07 GMT 2024

Powered by FUDForum. Page generated in 0.02452 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top