diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java index 173f55fdbd..1541d1fdc1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java @@ -19,6 +19,7 @@ class Prompter { XPCOMObject supports; XPCOMObject prompt; int refCount = 0; + int /*long*/ parent; Prompter () { createCOMInterfaces (); @@ -93,6 +94,11 @@ int Release () { return refCount; } +Browser getBrowser () { + if (parent == 0) return null; + return Mozilla.getBrowser (parent); +} + String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) { String label = null; int flag = (buttonFlag & (0xff * index)) / index; @@ -112,6 +118,10 @@ String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) { return label; } +void setParent(int /*long*/ aParent) { + parent = aParent; +} + /* nsIPrompt */ int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) { @@ -144,36 +154,6 @@ int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) { return XPCOM.NS_OK; } -Browser getBrowser() { - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, !Mozilla.IsPre_4 ? nsIFocusManager.NS_IFOCUSMANAGER_10_IID : nsIFocusManager.NS_IFOCUSMANAGER_IID, result); - serviceManager.Release (); - - if (rc == XPCOM.NS_OK && result[0] != 0) { - nsIFocusManager focusManager = new nsIFocusManager (result[0]); - result[0] = 0; - rc = focusManager.GetActiveWindow (result); - focusManager.Release (); - if (rc == XPCOM.NS_OK && result[0] != 0) { - nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); - result[0] = 0; - rc = domWindow.GetTop(result); - domWindow.Release(); - if (rc == XPCOM.NS_OK && result[0] != 0) { - return Mozilla.getBrowser(result[0]); - } - } - } - return null; -} - int AlertCheck (int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) { Browser browser = getBrowser (); |