Skip to content

Commit 6d0d4e6

Browse files
raghucssitiloveeclipse
authored andcommitted
Disable viewer limit and mark new API as provisional
- made isExpandableNode() public to avoid force clients subclassing Tree/Table viewers that shouldn't be extended. - added EXPERIMENTAL to -- isExpandableNode() / setDisplayIncrementally() -- IWorkbenchPreferenceConstants.LARGE_VIEW_LIMIT -- WorkbenchViewerSetup - adopted tests Fixes #1030
1 parent dca05b9 commit 6d0d4e6

File tree

7 files changed

+49
-18
lines changed

7 files changed

+49
-18
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewer.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ Object[] getChildrenWithLimitApplied(final Object parent, Item[] visibleChildren
942942
} finally {
943943
setDisplayIncrementally(limit);
944944
}
945-
945+
946946
// model has lost some elements and length is less then visible items.
947947
if (sortedAll.length < visibleItemsLength) {
948948
return sortedAll;
@@ -993,6 +993,12 @@ int getItemsLimit() {
993993
}
994994

995995
/**
996+
* <p>
997+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
998+
* of a work in progress. There is no guarantee that this API will work or that
999+
* it will remain the same. Please do not use this API without consulting with
1000+
* the API development team.
1001+
* </p>
9961002
* Sets the viewers items limit on direct children at one level.
9971003
* <p>
9981004
* If the number of direct children will exceed this limit, the viewer will only
@@ -1045,11 +1051,18 @@ protected void handleDoubleSelect(SelectionEvent event) {
10451051
}
10461052

10471053
/**
1048-
* @param element
1054+
* <p>
1055+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
1056+
* of a work in progress. There is no guarantee that this API will work or that
1057+
* it will remain the same. Please do not use this API without consulting with
1058+
* the API development team.
1059+
* </p>
1060+
*
1061+
* @param element model object representing a special "expandable" node
10491062
* @return return if it is an instance of ExpandableNode
10501063
* @since 3.31
10511064
*/
1052-
protected boolean isExpandableNode(Object element) {
1065+
public final boolean isExpandableNode(Object element) {
10531066
return element instanceof ExpandableNode;
10541067

10551068
}

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,13 @@ public interface IWorkbenchPreferenceConstants {
687687
String DISPOSE_CLOSED_BROWSER_HOVER_TIMEOUT = "disposeClosedBrowserHoverTimeout"; //$NON-NLS-1$
688688

689689
/**
690+
* <p>
691+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
692+
* of a work in progress. There is no guarantee that this API will work or that
693+
* it will remain the same. Please do not use this API without consulting with
694+
* the API development team.
695+
* </p>
696+
*
690697
* This preference specifies the limit for number of children that can be shown
691698
* per parent element without expanding.
692699
* <p>

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public void initializeDefaultPreferences() {
126126

127127
node.putInt(IWorkbenchPreferenceConstants.DISPOSE_CLOSED_BROWSER_HOVER_TIMEOUT, -1);
128128

129-
// Don't show more than 10.000 child elements per parent by default
130-
node.putInt(IWorkbenchPreferenceConstants.LARGE_VIEW_LIMIT, 1000);
129+
// Disable viewer limit configuration until more testing and stabilization.
130+
node.putInt(IWorkbenchPreferenceConstants.LARGE_VIEW_LIMIT, 0);
131131

132132
node.put(IWorkbenchPreferenceConstants.RESOURCE_RENAME_MODE,
133133
IWorkbenchPreferenceConstants.RESOURCE_RENAME_MODE_INLINE);

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/WorkbenchViewerSetup.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
import org.eclipse.ui.internal.WorkbenchPlugin;
2727

2828
/**
29+
* <p>
30+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
31+
* of a work in progress. There is no guarantee that this API will work or that
32+
* it will remain the same. Please do not use this API without consulting with
33+
* the API development team.
34+
* </p>
35+
*
2936
* @since 3.130
3037
*/
3138
public class WorkbenchViewerSetup {
@@ -58,8 +65,14 @@ public void propertyChange(PropertyChangeEvent event) {
5865
}
5966

6067
/**
68+
* <p>
69+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
70+
* of a work in progress. There is no guarantee that this API will work or that
71+
* it will remain the same. Please do not use this API without consulting with
72+
* the API development team.
73+
* </p>
74+
*
6175
* Returns the current viewer limit set in the {@code General} preference page.
62-
* Default value is set to {@code 10000}
6376
*
6477
* @return {@link IWorkbenchPreferenceConstants#LARGE_VIEW_LIMIT}
6578
*/
@@ -72,6 +85,13 @@ private static IPreferenceStore getPreferenceStore() {
7285
}
7386

7487
/**
88+
* <p>
89+
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
90+
* of a work in progress. There is no guarantee that this API will work or that
91+
* it will remain the same. Please do not use this API without consulting with
92+
* the API development team.
93+
* </p>
94+
*
7595
* Configure a {@link ColumnViewer} to show limited items per parent before
7696
* showing an ExpandableNode. Limit used is read from preference
7797
* {@link IWorkbenchPreferenceConstants#LARGE_VIEW_LIMIT}. Client must call this

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TableViewerWithLimitTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,6 @@ class TestTableViewer extends TableViewer {
329329
public TestTableViewer(Composite parent) {
330330
super(parent);
331331
}
332-
333-
@Override
334-
public boolean isExpandableNode(Object element) {
335-
return super.isExpandableNode(element);
336-
}
337332
}
338333

339334
}

tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,6 @@ class TestTreeViewer extends TreeViewer {
327327
public TestTreeViewer(Composite parent) {
328328
super(parent);
329329
}
330-
331-
@Override
332-
public boolean isExpandableNode(Object element) {
333-
return super.isExpandableNode(element);
334-
}
335330
}
336331

337332
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/preferences/ViewerItemsLimitTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ protected void doSetUp() throws Exception {
8989
super.doSetUp();
9090
cleanUp();
9191
preferenceStore = WorkbenchPlugin.getDefault().getPreferenceStore();
92-
int viewLimit = preferenceStore.getInt(IWorkbenchPreferenceConstants.LARGE_VIEW_LIMIT);
93-
assertEquals("Default viewer limit must be " + DEFAULT_VIEW_LIMIT, DEFAULT_VIEW_LIMIT, viewLimit);
92+
// TODO: preference is set to zero, enable once preference is restored
93+
// int viewLimit = preferenceStore.getInt(IWorkbenchPreferenceConstants.LARGE_VIEW_LIMIT);
94+
// assertEquals("Default viewer limit must be " + DEFAULT_VIEW_LIMIT, DEFAULT_VIEW_LIMIT, viewLimit);
9495
window = getActiveWindow();
9596
activePage = window.getActivePage();
9697
defaultPerspective = activePage.getPerspective();

0 commit comments

Comments
 (0)