Bug 335696 - Provide helper method for embedding in AWT/Swing (Mac only for the moment). r=bsmeberg

git-svn-id: svn://10.0.0.236/trunk@216856 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pedemont%us.ibm.com
2006-12-11 21:07:02 +00:00
parent 58b58f6992
commit a696c4c0e4
10 changed files with 152 additions and 20 deletions

View File

@@ -40,16 +40,24 @@ import java.io.File;
public interface IMozilla {
/**
* Initialize the Mozilla object with the given XULRunner path. All
* subsequent Mozilla method invocations be done against the given XULRunner
* version.
*
* @param aLibXULDirectory path of XULRunner build to use
*
* @throws XPCOMInitializationException if failure occurred during
* initialization
*/
void initialize(File aLibXULDirectory) throws XPCOMInitializationException;
/**
* Initialize the Mozilla object with the given XULRunner path. All
* subsequent Mozilla method invocations be done against the given XULRunner
* version.
*
* @param aLibXULDirectory path of XULRunner build to use
*
* @throws XPCOMInitializationException if failure occurred during
* initialization
*/
void initialize(File aLibXULDirectory) throws XPCOMInitializationException;
/**
* Return the native window handle for an AWT component.
*
* @param widget An AWT component (such as Canvas, Frame) that is backed by
* a real native window.
* @return the pointer to the native window (platform specific)
*/
long getNativeHandleFromAWT(Object widget);
}

View File

@@ -1026,4 +1026,13 @@ public class Mozilla implements IMozilla, IGRE, IXPCOM, IXPCOMError {
return iid;
}
public long getNativeHandleFromAWT(Object widget) {
try {
return mozilla.getNativeHandleFromAWT(widget);
} catch (NullPointerException e) {
throw new XPCOMInitializationException("Must call " +
"Mozilla.getInstance().initialize() before using this method", e);
}
}
}