Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Priya Shanmugam2019-05-20 09:33:29 +0000
committerLakshmi Shanmugam2019-06-26 10:10:45 +0000
commit700308f6dce72e976834150d71fdc28424a79012 (patch)
treeea44d832d0433fbd6893c33684b988b010cce965
parent7674fe5357e7c32b5ab7bb329dd7b553bc0e622a (diff)
downloadeclipse.platform.swt-700308f6dce72e976834150d71fdc28424a79012.tar.gz
eclipse.platform.swt-700308f6dce72e976834150d71fdc28424a79012.tar.xz
eclipse.platform.swt-700308f6dce72e976834150d71fdc28424a79012.zip
Bug 546159 - NullPointerException when adding items to Mac OS native
toolbar with Java 11 On Mac 10.14, the class name returned was NSTitlebarContainerView instead of the expected NSToolbarView. This is because the position of NSToolbarView has changed: NSTitlebarContainerView > NSTitleBarView > NSToolbarView. Change-Id: I4df79cb655d384726e85ad70611b1064e4f4167a
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
index 699a0d64e2..6b10254e5b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
@@ -243,15 +243,27 @@ void createHandle () {
NSWindow window = parent.view.window();
window.setToolbar(nsToolbar);
nsToolbar.setVisible(true);
+
NSArray views = window.contentView().superview().subviews();
- for (int i = 0; i < views.count(); i++) {
+ int i = 0;
+ while (i < views.count()) {
id id = views.objectAtIndex(i);
- if (new NSObject(id).className().getString().equals("NSToolbarView")) {
+ String className = new NSObject(id).className().getString();
+ if (className.equals("NSToolbarView")) {
view = new NSView(id);
OS.object_setClass(view.id, OS.objc_getClass("SWTToolbarView"));
view.retain();
break;
}
+ if (className.equals("NSTitlebarContainerView")) {
+ views = new NSView(id).subviews();
+ i = 0;
+ } else if (className.equals("NSTitlebarView")) {
+ views = new NSView(id).subviews();
+ i = 0;
+ } else {
+ i++;
+ }
}
style &= ~SWT.SMOOTH;
} else {

Back to the top