|
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 |