Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java7
-rw-r--r--bundles/org.eclipse.swt/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.swt/build.xml2
-rw-r--r--bundles/org.eclipse.swt/pom.xml2
-rw-r--r--tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java51
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java63
-rw-r--r--tests/org.eclipse.swt.tests.gtk/pom.xml2
9 files changed, 130 insertions, 8 deletions
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 33cc37bce7..04be6d1a34 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
@@ -253,11 +253,16 @@ long /*int*/ cellDataProc (long /*int*/ tree_column, long /*int*/ cell, long /*i
}
if (modelIndex == -1) return 0;
boolean setData = false;
+ boolean updated = false;
if ((style & SWT.VIRTUAL) != 0) {
if (!item.cached) {
//lastIndexOf = index [0];
setData = checkData (item);
}
+ if (item.updated) {
+ updated = true;
+ item.updated = false;
+ }
}
long /*int*/ [] ptr = new long /*int*/ [1];
if (setData) {
@@ -309,7 +314,7 @@ long /*int*/ cellDataProc (long /*int*/ tree_column, long /*int*/ cell, long /*i
}
}
}
- if (setData) {
+ if (setData || updated) {
ignoreCell = cell;
setScrollWidth (tree_column, item);
ignoreCell = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index e897319ec9..edd09b039c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -39,7 +39,7 @@ public class TreeItem extends Item {
Font font;
Font[] cellFont;
String [] strings;
- boolean cached, grayed, isExpanded;
+ boolean cached, grayed, isExpanded, updated;
static final int EXPANDER_EXTRA_PADDING = 4;
/**
@@ -1216,7 +1216,7 @@ public void setBackground (int index, Color color) {
GTK.gtk_tree_store_set (parent.modelHandle, handle, modelIndex + Tree.CELL_BACKGROUND, gdkColor, -1);
}
cached = true;
-
+ updated = true;
if (color != null) {
boolean customDraw = (parent.columnCount == 0) ? parent.firstCustomDraw : parent.columns [index].customDraw;
@@ -1467,6 +1467,7 @@ public void setForeground (int index, Color color){
GTK.gtk_tree_store_set (parent.modelHandle, handle, modelIndex + Tree.CELL_FOREGROUND, gdkColor, -1);
}
cached = true;
+ updated = true;
if (color != null) {
boolean customDraw = (parent.columnCount == 0) ? parent.firstCustomDraw : parent.columns [index].customDraw;
@@ -1650,6 +1651,7 @@ public void setImage (int index, Image image) {
}
}
cached = true;
+ updated = true;
}
@Override
@@ -1738,6 +1740,7 @@ public void setText (int index, String string) {
int modelIndex = parent.columnCount == 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex;
GTK.gtk_tree_store_set (parent.modelHandle, handle, modelIndex + Tree.CELL_TEXT, buffer, -1);
cached = true;
+ updated = true;
}
@Override
diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
index 514e538cfe..631a12b120 100644
--- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt; singleton:=true
-Bundle-Version: 3.107.0.qualifier
+Bundle-Version: 3.107.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
DynamicImport-Package: org.eclipse.swt.accessibility2
diff --git a/bundles/org.eclipse.swt/build.xml b/bundles/org.eclipse.swt/build.xml
index 821d8b91be..8c25eaa292 100644
--- a/bundles/org.eclipse.swt/build.xml
+++ b/bundles/org.eclipse.swt/build.xml
@@ -15,7 +15,7 @@
<target name="init">
<property name="plugin" value="org.eclipse.swt" />
- <property name="version.suffix" value="3.106.100" />
+ <property name="version.suffix" value="3.107.100" />
<property name="full.name" value="${plugin}_${version.suffix}" />
<property name="temp.folder" value="${basedir}/temp.folder" />
<property name="plugin.destination" value="${basedir}" />
diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml
index 85f66c2952..ef4e879ff2 100644
--- a/bundles/org.eclipse.swt/pom.xml
+++ b/bundles/org.eclipse.swt/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt</artifactId>
- <version>3.107.0-SNAPSHOT</version>
+ <version>3.107.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<forceContextQualifier>v20180523-1901</forceContextQualifier>
diff --git a/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF b/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF
index 36a60085bc..29dc8f69be 100644
--- a/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.swt.tests.gtk
-Bundle-Version: 3.106.0.qualifier
+Bundle-Version: 3.107.100.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.junit;bundle-version="4.12.0",
org.eclipse.swt
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java
new file mode 100644
index 0000000000..d7c60a83b3
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Red Hat 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class Bug258196_VirtualTreeResizing {
+ public static void main(String[] args) {
+ final Display display = new Display();
+ final Shell shell = new Shell(display);
+ shell.setLayout (new FillLayout());
+ final Tree tree = new Tree(shell, SWT.VIRTUAL | SWT.BORDER);
+ tree.addListener(SWT.SetData, event -> {
+ final TreeItem item = (TreeItem)event.item;
+ TreeItem parentItem = item.getParentItem();
+ String text = null;
+ if (parentItem == null) {
+ text = "node "+tree.indexOf(item);
+ } else {
+ text = parentItem.getText()+" - "+parentItem.indexOf(item);
+ }
+ item.setData(text);
+ item.setItemCount(10);
+ display.asyncExec(() -> {
+ if (!item.isDisposed()) {
+ item.setText(item.getData().toString());
+ }
+ });
+ });
+ tree.setItemCount(20);
+ shell.setSize(400, 300);
+ shell.open();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
+ }
+}
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java
new file mode 100644
index 0000000000..8c713e2de0
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class Bug490203_VirtualTreePerf {
+ static final int COUNT = 10_000;
+
+ public static void main(String[] args) {
+ Display display = new Display ();
+ final Shell shell = new Shell (display);
+ shell.setLayout (new RowLayout (SWT.VERTICAL));
+ final Tree tree = new Tree (shell, SWT.VIRTUAL | SWT.BORDER);
+ TreeItem[] top = { null };
+ tree.addListener (SWT.SetData, event -> {
+ TreeItem item = (TreeItem) event.item;
+ if (item.getParentItem() == null) {
+ top[0] = item;
+ item.setText("top");
+ } else {
+ int index = top[0].indexOf (item);
+ item.setText ("Item " + index);
+ }
+ System.out.println (item.getText ());
+ });
+ tree.setLayoutData (new RowData (200, 200));
+ Button button = new Button (shell, SWT.PUSH);
+ button.setText ("&Add Items");
+ final Label label = new Label(shell, SWT.NONE);
+ button.addListener (SWT.Selection, event -> {
+ long t1 = System.currentTimeMillis ();
+ top[0].setItemCount (COUNT);
+ top[0].setExpanded(true);
+ long t2 = System.currentTimeMillis ();
+ label.setText ("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)");
+ shell.layout ();
+ });
+ tree.setItemCount (1);
+ shell.pack ();
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
+ }
+}
diff --git a/tests/org.eclipse.swt.tests.gtk/pom.xml b/tests/org.eclipse.swt.tests.gtk/pom.xml
index eb1a9bbb61..3720418b87 100644
--- a/tests/org.eclipse.swt.tests.gtk/pom.xml
+++ b/tests/org.eclipse.swt.tests.gtk/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tests.gtk</artifactId>
- <version>3.106.0-SNAPSHOT</version>
+ <version>3.107.100-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>

Back to the top