June 2004
Beginner to intermediate
364 pages
7h 38m
English
You want to give users some online access—for example, to access online help.
Use an SWT browser widget. Starting in Eclipse 3.0, SWT contains a browser widget built in.
In Eclipse 2.x, you do not have much choice for displaying browsers
in SWT windows. You really can do so only in Windows, using OLE.
Here’s how it works. You create an
OleFrame object and connect the
system’s browser to it:
import org.eclipse.swt.ole.win32.*;
.
.
.
OleControlSite oleControlSite;
OleFrame oleFrame = new OleFrame(shell, SWT.NONE);
oleControlSite = new OleControlSite(oleFrame, SWT.NONE, "Shell.Explorer");
oleControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
shell.open( );
.
.
.Then you create an OleAutomation object and
navigate to the URL you want like so:
import org.eclipse.swt.ole.win32.*;
.
.
.
OleControlSite oleControlSite;
OleFrame oleFrame = new OleFrame(shell, SWT.NONE);
oleControlSite = new OleControlSite(oleFrame, SWT.NONE, "Shell.Explorer");
oleControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
shell.open( );
final OleAutomation browser = new OleAutomation(oleControlSite);
int[] browserIDs = browser.getIDsOfNames(new String[]{"Navigate", "URL"});
Variant[] address = new Variant[] {new Variant("http://www.oreilly.com")};
browser.invoke(browserIDs[0], address, new int[]{browserIDs[1]});In Eclipse 3.x, life is easier because SWT comes with a built-in browser widget. This widget currently is supported in Windows (using Internet ...
Read now
Unlock full access