Lines 318-324
Link Here
|
318 |
* Method declared on StructuredViewer. |
318 |
* Method declared on StructuredViewer. |
319 |
*/ |
319 |
*/ |
320 |
protected void internalRefresh(Object element) { |
320 |
protected void internalRefresh(Object element) { |
321 |
|
|
|
322 |
Control list = getControl(); |
321 |
Control list = getControl(); |
323 |
if (element == null || equals(element, getRoot())) { |
322 |
if (element == null || equals(element, getRoot())) { |
324 |
// the parent |
323 |
// the parent |
Lines 327-333
Link Here
|
327 |
} |
326 |
} |
328 |
unmapAllElements(); |
327 |
unmapAllElements(); |
329 |
List selection = getSelectionFromWidget(); |
328 |
List selection = getSelectionFromWidget(); |
330 |
|
329 |
|
|
|
330 |
int topIndex = -1; |
331 |
if (selection == null || selection.isEmpty()) { |
332 |
topIndex = listGetTopIndex(); |
333 |
} |
334 |
|
331 |
list.setRedraw(false); |
335 |
list.setRedraw(false); |
332 |
listRemoveAll(); |
336 |
listRemoveAll(); |
333 |
|
337 |
|
Lines 345-357
Link Here
|
345 |
|
349 |
|
346 |
listSetItems(items); |
350 |
listSetItems(items); |
347 |
list.setRedraw(true); |
351 |
list.setRedraw(true); |
348 |
setSelectionToWidget(selection, false); |
352 |
|
|
|
353 |
if (topIndex == -1) { |
354 |
setSelectionToWidget(selection, false); |
355 |
} else { |
356 |
listSetTopIndex(Math.min(topIndex, children.length)); |
357 |
} |
349 |
} else { |
358 |
} else { |
350 |
doUpdateItem(list, element, true); |
359 |
doUpdateItem(list, element, true); |
351 |
} |
360 |
} |
352 |
} |
361 |
} |
|
|
362 |
|
363 |
/** |
364 |
* Returns the index of the item currently at the top of the viewable area. |
365 |
* <p> |
366 |
* Default implementation returns -1. |
367 |
* </p> |
368 |
* @return index, -1 for none |
369 |
*/ |
370 |
protected int listGetTopIndex(){ |
371 |
return -1; |
372 |
} |
353 |
|
373 |
|
354 |
/** |
374 |
/** |
|
|
375 |
* Sets the index of the item to be at the top of the viewable area. |
376 |
* <p> |
377 |
* Default implementation does nothing. |
378 |
* </p> |
379 |
* @param index, -1 for none. index will always refer to a valid index. |
380 |
*/ |
381 |
protected void listSetTopIndex(int index) { |
382 |
} |
383 |
|
384 |
/** |
355 |
* Removes the given elements from this list viewer. |
385 |
* Removes the given elements from this list viewer. |
356 |
* |
386 |
* |
357 |
* @param elements the elements to remove |
387 |
* @param elements the elements to remove |