Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2020-04-08 03:25:58 -0400
committerLakshmi Shanmugam2020-04-08 03:25:58 -0400
commit02d92ec52ca3f449d20fbc6a6ead069b05ba6e35 (patch)
treec1c9de096c6761f8088a4b7961793fcda33a93a8
parent0bae13c63113e9f6a44348186b35fc878477f708 (diff)
downloadeclipse.platform.swt-02d92ec52ca3f449d20fbc6a6ead069b05ba6e35.tar.gz
eclipse.platform.swt-02d92ec52ca3f449d20fbc6a6ead069b05ba6e35.tar.xz
eclipse.platform.swt-02d92ec52ca3f449d20fbc6a6ead069b05ba6e35.zip
Bug 561487 - [Preferences] Preferences dialog empty tree
Added version guard for the fix so that macOS versions < 10.15 are not affected Change-Id: I96fea3a82e4e7fe0fee610c3eac30f3b445ab4e7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java40
2 files changed, 42 insertions, 38 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 402e594004..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,25 +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 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);
+ 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 f340f27042..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,25 +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 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);
+ 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);
+ }
}
}
}

Back to the top