diff options
author | Lakshmi Shanmugam | 2020-03-26 12:59:52 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2020-04-20 12:05:44 +0000 |
commit | e02620d3bde23c9c429b6d2326ec2e52e0d837d9 (patch) | |
tree | 4aa0cd377099ed86e610d9cd3076513c528676da | |
parent | db3b9862706572bc8d5fc6a23c3f38e9656bef9a (diff) | |
download | eclipse.platform.swt-e02620d3bde23c9c429b6d2326ec2e52e0d837d9.tar.gz eclipse.platform.swt-e02620d3bde23c9c429b6d2326ec2e52e0d837d9.tar.xz eclipse.platform.swt-e02620d3bde23c9c429b6d2326ec2e52e0d837d9.zip |
Bug 562316 - [Mac]Preferences tree is empty and Appearance color options
table in preferences is flipped
Combined fixes from Bug 561235 and Bug 561487
Change-Id: I05c91e0794b023c12f07cb0fdac849329670eb5d
Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java | 39 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java | 39 |
2 files changed, 42 insertions, 36 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java index 1bc6d529f2..bc3c194ac5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java @@ -3191,24 +3191,27 @@ public void showColumn (TableColumn column) { void showIndex (int index) { if (0 <= index && index < itemCount) { NSTableView tableView = (NSTableView)view; - if (tableView.headerView () == null) { - /** - * On macOS 10.15, scrollRowToVisible doesn't work properly if - * contentView's bounds is not set (i.e, width or height is 0). - * The contentView's bounds is set when the Table's header view is set. - * So don't call this code if Table has a header already. - */ - NSClipView contentView = scrollView.contentView (); - if (contentView != null) { - NSRect contentViewBounds = contentView.bounds (); - if (contentViewBounds.height == 0 || contentViewBounds.width == 0) { - NSView documentView = scrollView.documentView (); - if (documentView != null) { - NSRect documentViewBounds = documentView.bounds (); - NSSize size = new NSSize (); - size.width = documentViewBounds.width; - size.height = documentViewBounds.height; - contentView.setBoundsSize (size); + if (OS.VERSION >= OS.VERSION (10, 15, 0)) { + if (tableView.headerView () == null) { + /** + * On macOS 10.15, scrollRowToVisible doesn't work correctly if + * contentView's bounds is not set (i.e, width or height is 0). + * + * The contentView's bounds is set when the Table's header view is set. + * So don't call this code if Table has a header already. + */ + NSClipView contentView = scrollView.contentView (); + if (contentView != null) { + NSRect contentViewBounds = contentView.bounds (); + if (contentViewBounds.height == 0 || contentViewBounds.width == 0) { + NSView documentView = scrollView.documentView (); + if (documentView != null) { + NSRect documentViewBounds = documentView.bounds (); + NSSize size = new NSSize (); + size.width = contentViewBounds.width == 0 ? documentViewBounds.width : contentViewBounds.width; + size.height = contentViewBounds.height == 0 ? documentViewBounds.height : contentViewBounds.height; + contentView.setBoundsSize (size); + } } } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java index 1b6dc796ab..e5d4d6d113 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java @@ -3458,24 +3458,27 @@ void showItem (TreeItem item, boolean scroll) { } if (scroll) { NSOutlineView outlineView = (NSOutlineView) view; - if (outlineView.headerView () == null) { - /** - * On macOS 10.15, scrollRowToVisible doesn't work properly if - * contentView's bounds is not set (i.e, width or height is 0). - * The contentView's bounds is set when the Tree's header view is set. - * So don't call this code if Tree has a header already. - */ - NSClipView contentView = scrollView.contentView (); - if (contentView != null) { - NSRect contentViewBounds = contentView.bounds (); - if (contentViewBounds.height == 0 || contentViewBounds.width == 0) { - NSView documentView = scrollView.documentView (); - if (documentView != null) { - NSRect documentViewBounds = documentView.bounds (); - NSSize size = new NSSize (); - size.width = documentViewBounds.width; - size.height = documentViewBounds.height; - contentView.setBoundsSize (size); + if (OS.VERSION >= OS.VERSION (10, 15, 0)) { + if (outlineView.headerView () == null) { + /** + * On macOS 10.15, scrollRowToVisible doesn't work correctly if + * contentView's bounds is not set (i.e, width or height is 0). + * + * The contentView's bounds is set when the Tree's header view is set. + * So don't call this code if Tree has a header already. + */ + NSClipView contentView = scrollView.contentView (); + if (contentView != null) { + NSRect contentViewBounds = contentView.bounds (); + if (contentViewBounds.height == 0 || contentViewBounds.width == 0) { + NSView documentView = scrollView.documentView (); + if (documentView != null) { + NSRect documentViewBounds = documentView.bounds (); + NSSize size = new NSSize (); + size.width = contentViewBounds.width == 0 ? documentViewBounds.width : contentViewBounds.width; + size.height = contentViewBounds.height == 0 ? documentViewBounds.height : contentViewBounds.height; + contentView.setBoundsSize (size); + } } } } |