Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » What is the "F2 Widget", and can it be reused?
What is the "F2 Widget", and can it be reused? [message #464996] Fri, 02 December 2005 11:07 Go to next message
Paul E. Keyser is currently offline Paul E. Keyser
Messages: 878
Registered: July 2009
Senior Member
R3.1.1

Float the mouse over any Java-element, press F2, and get a nice "narrow-border, zero-header" window.
Nice widget, presumably somehow part of SWT -- what is it called or how is it made?

I tried to find out using the http://eclipse.org/swt/tools.php "Spy", but it gives the result
"WebSite" (which I do not believe) or else "Shell" (with styles like TOOL | RESIZE | ON_TOP | ...),
which could be true, I suppose, but how are the borders and header suppressed?

If this is not an SWT query, let me know, and I'll try over on "jdt".

Thanks,
Paul
Re: What is the "F2 Widget", and can it be reused? [message #465015 is a reply to message #464996] Fri, 02 December 2005 12:31 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex Blewitt
Messages: 946
Registered: July 2009
Senior Member
I think it's a Shell, but with SWT.NO_TRIM or SWT.TOOL set. Have a play around with what's there ...

The other alternative is to dig into the code that generates the window and see what it does.

Looking in plugin.xml of org.eclipse.jdt.ui, there's:


<key
sequence="F2"
contextId="org.eclipse.jdt.ui.javaEditorScope"
commandId="org.eclipse.jdt.ui.edit.text.java.show.javadoc"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/ >
[/xml]

Search for the commandId, and you find SHOW_JAVADOC in IJavaEditorActionDefinitionIds, and references to this field in BasicJavaEditorActionContributor and JavaEditor. Drill down, and you end up in DefaultInformationControl.

It looks like it's indeed using these fields in the constructor:

this(parent, SWT.TOOL | SWT.NO_TRIM, style, presenter, statusFieldText);


You can do this searching yourself if you've got the source as well, by opening the Plugin Development Perspective, navigating down the plugins list until you get to org.eclipse.jdt.ui, and then doing Import as Source. You can then use all the searching goodness that Eclispe gives you -- if you know where to look ;-)

Alex.
Re: What is the "F2 Widget", and can it be reused? [message #465023 is a reply to message #464996] Fri, 02 December 2005 16:40 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
Spy never lies ;-)

WebSite is an internal widget for the implementation of Browser on Windows -
look a little higher in the parent tree and you will see Browser.

If you create a Shell without any of SWT.TITLE, SWT.CLOSE, SWT.MIN or
SWT.MAX you will not get a title bar. In this case they use SWT.TOOL |
SWT.RESIZE | SWT.ON_TOP. You can even get rid of the borders using the
SWT.NO_TRIM style.


"Paul Keyser" <rolarenfan@earthlink.net> wrote in message
news:dmprg7$sn6$1@news.eclipse.org...
> R3.1.1
>
> Float the mouse over any Java-element, press F2, and get a nice
> "narrow-border, zero-header" window. Nice widget, presumably somehow part
> of SWT -- what is it called or how is it made?
>
> I tried to find out using the http://eclipse.org/swt/tools.php "Spy", but
> it gives the result "WebSite" (which I do not believe) or else "Shell"
> (with styles like TOOL | RESIZE | ON_TOP | ...), which could be true, I
> suppose, but how are the borders and header suppressed?
>
> If this is not an SWT query, let me know, and I'll try over on "jdt".
>
> Thanks,
> Paul
Re: What is the "F2 Widget", and can it be reused? [message #465030 is a reply to message #465023] Sat, 03 December 2005 05:15 Go to previous message
Paul E. Keyser is currently offline Paul E. Keyser
Messages: 878
Registered: July 2009
Senior Member
Thanks to both Veronica and Alex!

Paul
Previous Topic:Opening OS dialog stalls GUI events
Next Topic:in search of custom widgets
Goto Forum:
  


Current Time: Mon Jul 28 16:47:46 EDT 2014

Powered by FUDForum. Page generated in 0.03407 seconds