aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-10-24 11:29:57 -0400
committerSilenio Quarti2012-10-24 11:29:57 -0400
commitc9eeb929e996f0e46059cdc6d7ccee91fb0c125d (patch)
tree3a9030a134c3b6fe688e831821bf379738e1fab2
parent7850ac994d4ed45b1498711e60e3213e4115df40 (diff)
downloadeclipse.platform.swt-c9eeb929e996f0e46059cdc6d7ccee91fb0c125d.tar.gz
eclipse.platform.swt-c9eeb929e996f0e46059cdc6d7ccee91fb0c125d.tar.xz
eclipse.platform.swt-c9eeb929e996f0e46059cdc6d7ccee91fb0c125d.zip
Bug 391742 - User can do nothing when both a normal dialog pop up and FileDialog are there
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSAlert.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MessageBox.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java3
8 files changed, 30 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 50174a722f..ec555be824 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -50,7 +50,7 @@
<retval swt_gen="true"></retval>
</method>
<method selector="window" swt_gen="true">
- <retval swt_gen="true" swt_java_type="NSWindow"></retval>
+ <retval swt_gen="true" swt_java_type="NSPanel"></retval>
</method>
</class>
<class name="NSApplication" swt_gen="mixed" swt_superclass="NSResponder">
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSAlert.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSAlert.java
index 4d9135cff3..0546a4d088 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSAlert.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSAlert.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,9 +45,9 @@ public void setMessageText(NSString messageText) {
OS.objc_msgSend(this.id, OS.sel_setMessageText_, messageText != null ? messageText.id : 0);
}
-public NSWindow window() {
+public NSPanel window() {
long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_window);
- return result != 0 ? new NSWindow(result) : null;
+ return result != 0 ? new NSPanel(result) : null;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 6e045352bf..20af4b0cf6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -2189,7 +2189,13 @@ void invalidateVisibleRegion () {
}
boolean isActive () {
- return getShell().getModalShell () == null && display.getModalDialog () == null;
+ if (getShell().getModalShell () != null) return false;
+ Dialog dialog = display.getModalDialog();
+ if (dialog == null) return true;
+ NSPanel panel = display.getModalPanel();
+ if (panel == null) return false;
+ NSWindow parentWindow = view.window().parentWindow();
+ return parentWindow == null || parentWindow.id == panel.id;
}
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java
index 5a044d5ce3..0ac023ab3a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -136,7 +136,7 @@ public String open () {
if (parent != null && (style & SWT.SHEET) != 0) {
application.beginSheet(panel, parent.view.window (), null, 0, 0);
}
- display.setModalDialog(this);
+ display.setModalDialog(this, panel);
NSString dir = (filterPath != null && filterPath.length() > 0) ? NSString.stringWith(filterPath) : null;
long /*int*/ response = panel.runModalForDirectory(dir, null);
if (parent != null && (style & SWT.SHEET) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index 038bab63bd..fad1729f90 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -147,6 +147,7 @@ public class Display extends Device {
Shell [] modalShells;
Dialog modalDialog;
+ NSPanel modalPanel;
Menu menuBar;
Menu[] menus, popups;
@@ -1635,6 +1636,10 @@ Dialog getModalDialog () {
return modalDialog;
}
+NSPanel getModalPanel () {
+ return modalPanel;
+}
+
/**
* Returns an array of monitors attached to the device.
*
@@ -4380,11 +4385,7 @@ public void setData (String key, Object value) {
}
if (key.equals(SET_MODAL_DIALOG)) {
- if (value == null) {
- this.modalDialog = null;
- } else {
- this.modalDialog = (Dialog) value;
- }
+ setModalDialog (value != null ? (Dialog) value : null);
}
if (key.equals (MOZILLA_RUNNING)) {
@@ -4479,7 +4480,12 @@ void setMenuBar (Menu menu) {
}
void setModalDialog (Dialog modalDialog) {
+ setModalDialog(modalDialog, null);
+}
+
+void setModalDialog (Dialog modalDialog, NSPanel panel) {
this.modalDialog = modalDialog;
+ this.modalPanel = panel;
}
void setModalShell (Shell shell) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
index cd495d7b79..cfb4ecea8a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
@@ -257,7 +257,7 @@ public String open () {
if (parent != null && (style & SWT.SHEET) != 0) {
application.beginSheet(panel, parent.view.window (), null, 0, 0);
}
- display.setModalDialog(this);
+ display.setModalDialog(this, panel);
NSString dir = (filterPath != null && filterPath.length() > 0) ? NSString.stringWith(filterPath) : null;
NSString file = (fileName != null && fileName.length() > 0) ? NSString.stringWith(fileName) : null;
long /*int*/ response = panel.runModalForDirectory(dir, file);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MessageBox.java
index 8212b725dc..1950dcd17d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MessageBox.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MessageBox.java
@@ -202,7 +202,8 @@ public int open () {
break;
}
title = NSString.stringWith(this.title != null ? this.title : "");
- alert.window().setTitle(title);
+ NSPanel panel = alert.window();
+ panel.setTitle(title);
NSString message = NSString.stringWith(this.message != null ? this.message : "");
alert.setMessageText(message);
int response = 0;
@@ -215,7 +216,7 @@ public int open () {
if (jniRef == 0) error(SWT.ERROR_NO_HANDLES);
OS.object_setInstanceVariable(delegate.id, Display.SWT_OBJECT, jniRef);
alert.beginSheetModalForWindow(parent.view.window (), delegate, OS.sel_panelDidEnd_returnCode_contextInfo_, 0);
- display.setModalDialog(this);
+ display.setModalDialog(this, panel);
if ((style & SWT.APPLICATION_MODAL) != 0) {
response = (int)/*64*/alert.runModal();
} else {
@@ -227,7 +228,7 @@ public int open () {
response = this.returnCode;
}
} else {
- display.setModalDialog(this);
+ display.setModalDialog(this, panel);
response = (int)/*64*/alert.runModal();
}
display.setModalDialog(null);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
index 9c266ec313..6582d65fbf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
@@ -2074,7 +2074,8 @@ void updateParent (boolean visible) {
if (window != null) {
if (visible) {
if (parent != null && parent.getVisible ()) {
- parentWindow ().addChildWindow (window, OS.NSWindowAbove);
+ NSWindow parentWindow = display.modalPanel != null ? display.modalPanel : parentWindow ();
+ parentWindow.addChildWindow (window, OS.NSWindowAbove);
/**
* Feature in Cocoa: When a window is added as a child window,