Bug 424173 - table.showItem doesn't reveal the item on linux
Change-Id: I49f61cb3267fcd6ff34cfe67d7958bc1d23befb1
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index aeb8429..202a502 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -1662,4 +1662,19 @@
}
}
}
+
+public void setVisible (boolean visible) {
+ super.setVisible (visible);
+
+ /*
+ * Workaround for the Bug 424173 making the child elements visible so that
+ * the child elements can perform pending actions
+ */
+ Control [] list = getChildren ();
+ for (Control i: list) {
+ if ((i instanceof Table) || (i instanceof Tree)) {
+ i.setVisible (visible);
+ }
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 412bade..9563eff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -2308,6 +2308,18 @@
OS.gtk_widget_hide (shellHandle);
sendEvent (SWT.Hide);
}
+
+ /*
+ * Workaround for the Bug 424173 making the child elements visible so that
+ * the child elements can perform pending actions
+ */
+ Control [] list = getChildren ();
+
+ for (Control i: list) {
+ if (i instanceof Composite) {
+ i.setVisible (visible);
+ }
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index c1c5a32..f3c6bf2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -97,7 +97,8 @@
int drawState, drawFlags;
GdkColor drawForeground;
boolean ownerDraw, ignoreSize, ignoreAccessibility;
-
+ TableItem pendingShowItem = null;
+
static final int CHECKED_COLUMN = 0;
static final int GRAYED_COLUMN = 1;
static final int FOREGROUND_COLUMN = 2;
@@ -3524,6 +3525,16 @@
OS.gtk_tree_path_free (path);
}
+@Override
+public void setVisible (boolean visible) {
+ super.setVisible (visible);
+
+ if ((visible) && (pendingShowItem != null)) {
+ showItem (pendingShowItem);
+ pendingShowItem = null;
+ }
+}
+
/**
* Shows the column. If the column is already showing in the receiver,
* this method simply returns. Otherwise, the columns are scrolled until
@@ -3607,6 +3618,10 @@
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
if (item.parent != this) return;
+
+ if (!this.isVisible ()) {
+ pendingShowItem = item;
+ }
showItem (item.handle);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 3c1d8c5..2b3917d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -90,6 +90,7 @@
int drawState, drawFlags;
GdkColor drawForeground;
boolean ownerDraw, ignoreSize, ignoreAccessibility;
+ TreeItem pendingShowItem = null;
static final int ID_COLUMN = 0;
static final int CHECKED_COLUMN = 1;
@@ -3557,6 +3558,11 @@
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
if (item.parent != this) return;
+
+ if (!this.isVisible ()) {
+ pendingShowItem = item;
+ }
+
long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
showItem (path, true);
OS.gtk_tree_path_free (path);
@@ -3613,4 +3619,13 @@
return super.windowProc (handle, arg0, user_data);
}
+@Override
+public void setVisible (boolean visible) {
+ super.setVisible (visible);
+
+ if ((visible) && (pendingShowItem != null)) {
+ showItem (pendingShowItem);
+ pendingShowItem = null;
+ }
+}
}