1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[cleanup][189262] Avoid unnecessary casts

This commit is contained in:
Martin Oberhuber 2007-06-04 09:54:06 +00:00
parent ec4f6c3b2a
commit 37cacfc24b

View file

@ -2920,9 +2920,10 @@ public class SystemView extends SafeTreeViewer
Widget match = (Widget) matches.get(idx); Widget match = (Widget) matches.get(idx);
// a reference to this remote object // a reference to this remote object
if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) { if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
Object data = match.getData(); TreeItem matchedItem = (TreeItem)match;
boolean wasExpanded = ((TreeItem)match).getExpanded(); Object data = matchedItem.getData();
smartRefresh(new TreeItem[] { (TreeItem) match }); // refresh the remote object boolean wasExpanded = matchedItem.getExpanded();
smartRefresh(new TreeItem[] { matchedItem }); // refresh the remote object
if (firstSelection && // for now, we just select the first binary occurrence we find if (firstSelection && // for now, we just select the first binary occurrence we find
(data == remoteObject)) // same binary object as given? (data == remoteObject)) // same binary object as given?
{ {
@ -2934,13 +2935,10 @@ public class SystemView extends SafeTreeViewer
{ {
allowExpand = rmtAdapter.hasChildren((IAdaptable)data); allowExpand = rmtAdapter.hasChildren((IAdaptable)data);
} }
if (match instanceof Item) if (allowExpand && wasExpanded && !getExpanded(matchedItem)) // assume if callers wants to select kids that they want to expand parent
{ {
if (allowExpand && wasExpanded && !getExpanded((Item)match)) // assume if callers wants to select kids that they want to expand parent createChildren(matchedItem);
{ setExpanded(matchedItem, true);
createChildren(match);
setExpanded((Item)match, true);
}
} }
// todo: handle cumulative selections. // todo: handle cumulative selections.
// STEP 4: If requested, select the kids in the newly refreshed object. // STEP 4: If requested, select the kids in the newly refreshed object.