Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 341259
Collapse All | Expand All

(-).options (+3 lines)
Lines 9-14 Link Here
9
# Always log reentrant calls to viewers (if set to false, it just logs the first reentrant call)
9
# Always log reentrant calls to viewers (if set to false, it just logs the first reentrant call)
10
org.eclipse.jface/debug/viewers/reentrantViewerCalls=false
10
org.eclipse.jface/debug/viewers/reentrantViewerCalls=false
11
11
12
# Log illegal equal elements in a viewer
13
org.eclipse.jface/debug/viewers/equalElements=false
14
12
# Show the jface new look for the preferences dialog
15
# Show the jface new look for the preferences dialog
13
org.eclipse.jface/newlook/preferences/showNewLook=false
16
org.eclipse.jface/newlook/preferences/showNewLook=false
14
17
(-)src/org/eclipse/jface/internal/InternalPolicy.java (-1 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
2
 * Copyright (c) 2007, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 25-30 Link Here
25
	 * @since 3.3
25
	 * @since 3.3
26
	 */
26
	 */
27
	public static boolean DEBUG_LOG_REENTRANT_VIEWER_CALLS = false;
27
	public static boolean DEBUG_LOG_REENTRANT_VIEWER_CALLS = false;
28
	
29
	/**
30
	 * (NON-API) A flag to indicate whether illegal equal elements in a viewer should be logged.
31
	 * 
32
	 * @since 3.7
33
	 */
34
	public static boolean DEBUG_LOG_EQUAL_VIEWER_ELEMENTS= false;
28
35
29
	/**
36
	/**
30
	 * (NON-API) A flag to indicate whether label provider changed notifications
37
	 * (NON-API) A flag to indicate whether label provider changed notifications
(-)src/org/eclipse/jface/viewers/AbstractTreeViewer.java (-5 / +42 lines)
Lines 23-28 Link Here
23
import java.util.LinkedList;
23
import java.util.LinkedList;
24
import java.util.List;
24
import java.util.List;
25
25
26
import org.eclipse.core.runtime.Assert;
27
import org.eclipse.core.runtime.IStatus;
28
import org.eclipse.core.runtime.ListenerList;
29
import org.eclipse.core.runtime.Status;
30
import org.eclipse.jface.internal.InternalPolicy;
31
import org.eclipse.jface.util.Policy;
32
import org.eclipse.jface.util.SafeRunnable;
26
import org.eclipse.swt.SWT;
33
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.custom.BusyIndicator;
34
import org.eclipse.swt.custom.BusyIndicator;
28
import org.eclipse.swt.events.SelectionEvent;
35
import org.eclipse.swt.events.SelectionEvent;
Lines 34-44 Link Here
34
import org.eclipse.swt.widgets.Item;
41
import org.eclipse.swt.widgets.Item;
35
import org.eclipse.swt.widgets.Widget;
42
import org.eclipse.swt.widgets.Widget;
36
43
37
import org.eclipse.core.runtime.Assert;
38
import org.eclipse.core.runtime.ListenerList;
39
40
import org.eclipse.jface.util.SafeRunnable;
41
42
/**
44
/**
43
 * Abstract base implementation for tree-structure-oriented viewers (trees and
45
 * Abstract base implementation for tree-structure-oriented viewers (trees and
44
 * table trees).
46
 * table trees).
Lines 1349-1360 Link Here
1349
					}
1351
					}
1350
					Object[] result = tpcp.getChildren(path);
1352
					Object[] result = tpcp.getChildren(path);
1351
					if (result != null) {
1353
					if (result != null) {
1354
						assertElementsNotNull(parent, result);
1352
						return result;
1355
						return result;
1353
					}
1356
					}
1354
				} else if (cp instanceof ITreeContentProvider) {
1357
				} else if (cp instanceof ITreeContentProvider) {
1355
					ITreeContentProvider tcp = (ITreeContentProvider) cp;
1358
					ITreeContentProvider tcp = (ITreeContentProvider) cp;
1356
					Object[] result = tcp.getChildren(parent);
1359
					Object[] result = tcp.getChildren(parent);
1357
					if (result != null) {
1360
					if (result != null) {
1361
						assertElementsNotNull(parent, result);
1358
						return result;
1362
						return result;
1359
					}
1363
					}
1360
				}
1364
				}
Lines 1366-1371 Link Here
1366
	}
1370
	}
1367
1371
1368
	/**
1372
	/**
1373
	 * Asserts that the given array of elements is itself non- <code>null</code>
1374
	 * and contains no <code>null</code> elements.
1375
	 * 
1376
	 * @param parent
1377
	 *            the parent element
1378
	 * @param elements
1379
	 *            the array to check
1380
	 */
1381
	private void assertElementsNotNull(Object parent, Object[] elements) {
1382
		Assert.isNotNull(elements);
1383
		for (int i = 0, n = elements.length; i < n; ++i) {
1384
			Assert.isNotNull(elements[i]);
1385
		}
1386
		
1387
		if (InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS
1388
				&& elements.length > 1) {
1389
			CustomHashtable elementSet = newHashtable(elements.length * 2);
1390
			for (int i = 0; i < elements.length; i++) {
1391
				Object element = elements[i];
1392
				Object old = elementSet.put(element, element);
1393
				if (old != null) {
1394
					String message = "Sibling elements in viewer must not be equal:\n  " //$NON-NLS-1$
1395
							+ old + ",\n  " + element + ",\n  parent: " + parent; //$NON-NLS-1$ //$NON-NLS-2$
1396
					Policy.getLog().log(
1397
							new Status(IStatus.WARNING, Policy.JFACE, message,
1398
									new RuntimeException()));
1399
					return;
1400
				}
1401
			}
1402
		}
1403
	}
1404
	
1405
	/**
1369
	 * Returns all selected items for the given SWT control.
1406
	 * Returns all selected items for the given SWT control.
1370
	 *
1407
	 *
1371
	 * @param control
1408
	 * @param control
(-)src/org/eclipse/jface/viewers/StructuredViewer.java (-1 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-25 Link Here
17
import java.util.List;
17
import java.util.List;
18
18
19
import org.eclipse.core.runtime.Assert;
19
import org.eclipse.core.runtime.Assert;
20
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.ListenerList;
21
import org.eclipse.core.runtime.ListenerList;
22
import org.eclipse.core.runtime.Status;
23
import org.eclipse.jface.internal.InternalPolicy;
21
import org.eclipse.jface.util.IOpenEventListener;
24
import org.eclipse.jface.util.IOpenEventListener;
22
import org.eclipse.jface.util.OpenStrategy;
25
import org.eclipse.jface.util.OpenStrategy;
26
import org.eclipse.jface.util.Policy;
23
import org.eclipse.jface.util.SafeRunnable;
27
import org.eclipse.jface.util.SafeRunnable;
24
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.custom.TableTreeItem;
29
import org.eclipse.swt.custom.TableTreeItem;
Lines 594-599 Link Here
594
		for (int i = 0, n = elements.length; i < n; ++i) {
598
		for (int i = 0, n = elements.length; i < n; ++i) {
595
			Assert.isNotNull(elements[i]);
599
			Assert.isNotNull(elements[i]);
596
		}
600
		}
601
		
602
		if (InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS
603
				&& elements.length > 1) {
604
			CustomHashtable elementSet = newHashtable(elements.length * 2);
605
			for (int i = 0; i < elements.length; i++) {
606
				Object element = elements[i];
607
				Object old = elementSet.put(element, element);
608
				if (old != null) {
609
					String message = "Sibling elements in viewer must not be equal:\n  " //$NON-NLS-1$
610
							+ old + ",\n  " + element; //$NON-NLS-1$
611
					Policy.getLog().log(
612
							new Status(IStatus.WARNING, Policy.JFACE, message,
613
									new RuntimeException()));
614
					return;
615
				}
616
			}
617
		}
597
	}
618
	}
598
619
599
	/**
620
	/**
(-)Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java (-2 / +3 lines)
Lines 16-23 Link Here
16
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
17
import org.eclipse.core.runtime.SafeRunner;
17
import org.eclipse.core.runtime.SafeRunner;
18
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
18
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
19
import org.eclipse.core.runtime.preferences.InstanceScope;
20
import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
19
import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
20
import org.eclipse.core.runtime.preferences.InstanceScope;
21
import org.eclipse.jface.internal.InternalPolicy;
21
import org.eclipse.jface.internal.InternalPolicy;
22
import org.eclipse.jface.preference.JFacePreferences;
22
import org.eclipse.jface.preference.JFacePreferences;
23
import org.eclipse.jface.util.ILogger;
23
import org.eclipse.jface.util.ILogger;
Lines 72-82 Link Here
72
		});
72
		});
73
73
74
		// Get all debug options from Platform
74
		// Get all debug options from Platform
75
		if ("true".equalsIgnoreCase(Platform.getDebugOption("/debug"))) { //$NON-NLS-1$ //$NON-NLS-2$
75
		if ("true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug"))) { //$NON-NLS-1$ //$NON-NLS-2$
76
			Policy.DEBUG_DIALOG_NO_PARENT = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/dialog/noparent")); //$NON-NLS-1$ //$NON-NLS-2$
76
			Policy.DEBUG_DIALOG_NO_PARENT = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/dialog/noparent")); //$NON-NLS-1$ //$NON-NLS-2$
77
			Policy.TRACE_ACTIONS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$
77
			Policy.TRACE_ACTIONS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$
78
			Policy.TRACE_TOOLBAR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
78
			Policy.TRACE_TOOLBAR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
79
			InternalPolicy.DEBUG_LOG_REENTRANT_VIEWER_CALLS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/reentrantViewerCalls")); //$NON-NLS-1$ //$NON-NLS-2$
79
			InternalPolicy.DEBUG_LOG_REENTRANT_VIEWER_CALLS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/reentrantViewerCalls")); //$NON-NLS-1$ //$NON-NLS-2$
80
			InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/equalElements")); //$NON-NLS-1$ //$NON-NLS-2$
80
		}
81
		}
81
	}
82
	}
82
83

Return to bug 341259