Lines 61-66
Link Here
|
61 |
* David McKnight (IBM) - [236874] NPE upon selecting an item that is not associated with subsystem |
61 |
* David McKnight (IBM) - [236874] NPE upon selecting an item that is not associated with subsystem |
62 |
* David McKnight (IBM) - [238363] Performance improvement for refresh in system view. |
62 |
* David McKnight (IBM) - [238363] Performance improvement for refresh in system view. |
63 |
* David McKnight (IBM) - [241722] New -> File doesn't select the newly created file |
63 |
* David McKnight (IBM) - [241722] New -> File doesn't select the newly created file |
|
|
64 |
* David McKnight (IBM) - [187739] [refresh] Sub Directories are collapsed when Parent Directory is Refreshed on Remote Systems |
64 |
********************************************************************************/ |
65 |
********************************************************************************/ |
65 |
|
66 |
|
66 |
package org.eclipse.rse.internal.ui.view; |
67 |
package org.eclipse.rse.internal.ui.view; |
Lines 130-135
Link Here
|
130 |
import org.eclipse.rse.core.filters.ISystemFilterString; |
131 |
import org.eclipse.rse.core.filters.ISystemFilterString; |
131 |
import org.eclipse.rse.core.filters.ISystemFilterStringReference; |
132 |
import org.eclipse.rse.core.filters.ISystemFilterStringReference; |
132 |
import org.eclipse.rse.core.model.IHost; |
133 |
import org.eclipse.rse.core.model.IHost; |
|
|
134 |
import org.eclipse.rse.core.model.IRSECallback; |
133 |
import org.eclipse.rse.core.model.ISystemContainer; |
135 |
import org.eclipse.rse.core.model.ISystemContainer; |
134 |
import org.eclipse.rse.core.model.ISystemMessageObject; |
136 |
import org.eclipse.rse.core.model.ISystemMessageObject; |
135 |
import org.eclipse.rse.core.model.ISystemRegistry; |
137 |
import org.eclipse.rse.core.model.ISystemRegistry; |
Lines 173-179
Link Here
|
173 |
import org.eclipse.rse.ui.model.SystemRemoteElementResourceSet; |
175 |
import org.eclipse.rse.ui.model.SystemRemoteElementResourceSet; |
174 |
import org.eclipse.rse.ui.model.SystemResourceChangeEventUI; |
176 |
import org.eclipse.rse.ui.model.SystemResourceChangeEventUI; |
175 |
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter; |
177 |
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter; |
176 |
import org.eclipse.rse.ui.view.ContextObject; |
|
|
177 |
import org.eclipse.rse.ui.view.IContextObject; |
178 |
import org.eclipse.rse.ui.view.IContextObject; |
178 |
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; |
179 |
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; |
179 |
import org.eclipse.rse.ui.view.ISystemSelectAllTarget; |
180 |
import org.eclipse.rse.ui.view.ISystemSelectAllTarget; |
Lines 3177-3182
Link Here
|
3177 |
TreeItem matchedItem = (TreeItem)match; |
3178 |
TreeItem matchedItem = (TreeItem)match; |
3178 |
Object data = matchedItem.getData(); |
3179 |
Object data = matchedItem.getData(); |
3179 |
boolean wasExpanded = matchedItem.getExpanded(); |
3180 |
boolean wasExpanded = matchedItem.getExpanded(); |
|
|
3181 |
|
3182 |
|
3183 |
|
3180 |
smartRefresh(new TreeItem[] { matchedItem }); // refresh the remote object |
3184 |
smartRefresh(new TreeItem[] { matchedItem }); // refresh the remote object |
3181 |
if (firstSelection && // for now, we just select the first binary occurrence we find |
3185 |
if (firstSelection && // for now, we just select the first binary occurrence we find |
3182 |
(data == remoteObject)) // same binary object as given? |
3186 |
(data == remoteObject)) // same binary object as given? |
Lines 3190-3199
Link Here
|
3190 |
allowExpand = rmtAdapter.hasChildren((IAdaptable)data); |
3194 |
allowExpand = rmtAdapter.hasChildren((IAdaptable)data); |
3191 |
} |
3195 |
} |
3192 |
if (allowExpand && wasExpanded && !getExpanded(matchedItem)) // assume if callers wants to select kids that they want to expand parent |
3196 |
if (allowExpand && wasExpanded && !getExpanded(matchedItem)) // assume if callers wants to select kids that they want to expand parent |
3193 |
{ |
3197 |
{ |
3194 |
createChildren(matchedItem); |
3198 |
createChildren(matchedItem); |
3195 |
setExpanded(matchedItem, true); |
3199 |
setExpanded(matchedItem, true); |
3196 |
} |
3200 |
} |
|
|
3201 |
|
3197 |
// todo: handle cumulative selections. |
3202 |
// todo: handle cumulative selections. |
3198 |
// STEP 4: If requested, select the kids in the newly refreshed object. |
3203 |
// STEP 4: If requested, select the kids in the newly refreshed object. |
3199 |
// If the same binary object appears multiple times, select the kids in the first occurrence. |
3204 |
// If the same binary object appears multiple times, select the kids in the first occurrence. |
Lines 3649-3655
Link Here
|
3649 |
ourInternalRefresh(currItem, currItem.getData(), true, true); // dispose of children, update plus |
3654 |
ourInternalRefresh(currItem, currItem.getData(), true, true); // dispose of children, update plus |
3650 |
|
3655 |
|
3651 |
if (wasExpanded[idx]) { |
3656 |
if (wasExpanded[idx]) { |
3652 |
createChildren(currItem); // re-expand |
3657 |
|
|
|
3658 |
// for deferred queries |
3659 |
class ExpandRemoteObjects implements IRSECallback { |
3660 |
private List _toExpand; |
3661 |
|
3662 |
public ExpandRemoteObjects(List toExpand){ |
3663 |
_toExpand = toExpand; |
3664 |
} |
3665 |
|
3666 |
public void done(IStatus status, Object result) { |
3667 |
|
3668 |
if (Display.getCurrent() != null){ // on main thread |
3669 |
execute(); |
3670 |
} |
3671 |
else { |
3672 |
// need to run this code on main thread |
3673 |
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() |
3674 |
{ |
3675 |
public void run() { |
3676 |
execute(); |
3677 |
} |
3678 |
}); |
3679 |
} |
3680 |
} |
3681 |
|
3682 |
private void execute() |
3683 |
{ |
3684 |
// expand each previously expanded sub-node, recursively |
3685 |
for (int idx = 0; idx < _toExpand.size(); idx++) { |
3686 |
ExpandedItem itemToExpand = (ExpandedItem) _toExpand.get(idx); |
3687 |
if (itemToExpand.isRemote()) { |
3688 |
// find remote item based on its original name and unchanged root parent |
3689 |
Item item = null; |
3690 |
item = findFirstRemoteItemReference(itemToExpand.remoteName, itemToExpand.subsystem, itemToExpand.parentItem); |
3691 |
|
3692 |
// if found, re-expand it |
3693 |
if (item != null) { |
3694 |
IRSECallback callback = getCallbackForSubChildren(itemToExpand.remoteName, _toExpand); |
3695 |
createChildren(item, callback); |
3696 |
((TreeItem) item).setExpanded(true); |
3697 |
} |
3698 |
} else if (itemToExpand.data!=null) { |
3699 |
setExpandedState(itemToExpand.data, true); |
3700 |
} |
3701 |
} |
3702 |
} |
3703 |
|
3704 |
private IRSECallback getCallbackForSubChildren(String remoteParentName, List itemsToExpand){ |
3705 |
List subChildren = new ArrayList(); |
3706 |
for (int i = 0; i < itemsToExpand.size(); i++){ |
3707 |
ExpandedItem itemToExpand = (ExpandedItem) itemsToExpand.get(i); |
3708 |
if (remoteParentName.equals(itemToExpand.remoteName)){ |
3709 |
// same item |
3710 |
} |
3711 |
else if (itemToExpand.remoteName.startsWith(remoteParentName)){ |
3712 |
// child item |
3713 |
subChildren.add(itemToExpand); |
3714 |
} |
3715 |
} |
3716 |
|
3717 |
if (subChildren.size() > 0){ |
3718 |
return new ExpandRemoteObjects(subChildren); |
3719 |
} |
3720 |
else { |
3721 |
return null; |
3722 |
} |
3723 |
} |
3724 |
} |
3725 |
|
3726 |
IRSECallback callback = new ExpandRemoteObjects(expandedChildren); |
3727 |
|
3728 |
createChildren(currItem, callback); // re-expand |
3653 |
currItem.setExpanded(true); |
3729 |
currItem.setExpanded(true); |
3654 |
} else // hmm, item was not expanded so just flush its memory |
3730 |
} else // hmm, item was not expanded so just flush its memory |
3655 |
{ |
3731 |
{ |
Lines 3657-3680
Link Here
|
3657 |
} |
3733 |
} |
3658 |
} |
3734 |
} |
3659 |
|
3735 |
|
3660 |
|
3736 |
// for non-deferred queries |
|
|
3737 |
|
3661 |
// 2. expand each previously expanded sub-node, recursively |
3738 |
// 2. expand each previously expanded sub-node, recursively |
3662 |
for (int idx = 0; idx < expandedChildren.size(); idx++) { |
3739 |
for (int idx = 0; idx < expandedChildren.size(); idx++) { |
3663 |
ExpandedItem itemToExpand = (ExpandedItem) expandedChildren.get(idx); |
3740 |
ExpandedItem itemToExpand = (ExpandedItem) expandedChildren.get(idx); |
3664 |
if (itemToExpand.isRemote()) { |
3741 |
if (itemToExpand.isRemote()) { |
3665 |
// find remote item based on its original name and unchanged root parent |
3742 |
// find remote item based on its original name and unchanged root parent |
3666 |
Item item = null; |
3743 |
Item item = null; |
3667 |
//if (itemToExpand.parentItem != null) |
|
|
3668 |
//item = (Item)recursiveFindRemoteItem(itemToExpand.parentItem, itemToExpand.remoteName, itemToExpand.subsystem); |
3669 |
//else |
3670 |
//item = (Item)findRemoteItem(itemToExpand.remoteName, itemToExpand.subsystem); |
3671 |
|
3744 |
|
3672 |
//************************************************************/// |
3745 |
// for deferred queries, we handle this via a callback |
3673 |
// FIXME!! |
|
|
3674 |
// TODO |
3675 |
// DKM - problem here is that if a query is in progress, then we won't find it until the deferred query completes |
3676 |
item = findFirstRemoteItemReference(itemToExpand.remoteName, itemToExpand.subsystem, itemToExpand.parentItem); |
3746 |
item = findFirstRemoteItemReference(itemToExpand.remoteName, itemToExpand.subsystem, itemToExpand.parentItem); |
3677 |
//************************************************************/// |
3747 |
|
3678 |
// if found, re-expand it |
3748 |
// if found, re-expand it |
3679 |
if (item != null) { |
3749 |
if (item != null) { |
3680 |
//setExpanded(item, true); |
3750 |
//setExpanded(item, true); |
Lines 6105-6117
Link Here
|
6105 |
public void add(Object parentElementOrTreePath, Object[] childElements) { |
6175 |
public void add(Object parentElementOrTreePath, Object[] childElements) { |
6106 |
|
6176 |
|
6107 |
assertElementsNotNull(childElements); |
6177 |
assertElementsNotNull(childElements); |
6108 |
|
6178 |
IContextObject contextObject = null; |
6109 |
ISystemFilterReference originalFilter = null; |
6179 |
ISystemFilterReference originalFilter = null; |
6110 |
if (parentElementOrTreePath instanceof IContextObject) |
6180 |
if (parentElementOrTreePath instanceof IContextObject) |
6111 |
{ |
6181 |
{ |
6112 |
IContextObject context = (IContextObject)parentElementOrTreePath; |
6182 |
contextObject = (IContextObject)parentElementOrTreePath; |
6113 |
originalFilter = context.getFilterReference(); |
6183 |
originalFilter = contextObject.getFilterReference(); |
6114 |
parentElementOrTreePath = context.getModelObject(); |
6184 |
parentElementOrTreePath = contextObject.getModelObject(); |
|
|
6185 |
|
6115 |
} |
6186 |
} |
6116 |
|
6187 |
|
6117 |
List matches = new Vector(); |
6188 |
List matches = new Vector(); |
Lines 6178-6185
Link Here
|
6178 |
Object[] newChildren = null; |
6249 |
Object[] newChildren = null; |
6179 |
if (match instanceof TreeItem) |
6250 |
if (match instanceof TreeItem) |
6180 |
{ |
6251 |
{ |
6181 |
IContextObject contextObject = getContextObject((TreeItem)match); |
6252 |
IContextObject context = getContextObject((TreeItem)match); |
6182 |
newChildren = adapter.getChildren(contextObject, new NullProgressMonitor()); |
6253 |
newChildren = adapter.getChildren(context, new NullProgressMonitor()); |
6183 |
internalAdd(match, parentElementOrTreePath, newChildren); |
6254 |
internalAdd(match, parentElementOrTreePath, newChildren); |
6184 |
} |
6255 |
} |
6185 |
} |
6256 |
} |
Lines 6236-6242
Link Here
|
6236 |
} |
6307 |
} |
6237 |
} |
6308 |
} |
6238 |
|
6309 |
|
6239 |
|
6310 |
// for bug 187739 |
|
|
6311 |
if (contextObject instanceof ContextObjectWithViewer) { |
6312 |
ContextObjectWithViewer ctx = (ContextObjectWithViewer)contextObject; |
6313 |
IRSECallback cb = ctx.getCallback(); |
6314 |
if (cb!=null) { |
6315 |
cb.done(Status.OK_STATUS, childElements); |
6316 |
} |
6317 |
} |
6240 |
} |
6318 |
} |
6241 |
|
6319 |
|
6242 |
|
6320 |
|
Lines 6320-6337
Link Here
|
6320 |
ISystemFilterReference filterReference = getContainingFilterReference(item); |
6398 |
ISystemFilterReference filterReference = getContainingFilterReference(item); |
6321 |
if (filterReference != null) |
6399 |
if (filterReference != null) |
6322 |
{ |
6400 |
{ |
6323 |
return new ContextObject(data, filterReference.getSubSystem(), filterReference); |
6401 |
return new ContextObjectWithViewer(data, filterReference.getSubSystem(), filterReference, this); |
6324 |
} |
6402 |
} |
6325 |
else |
6403 |
else |
6326 |
{ |
6404 |
{ |
6327 |
ISubSystem subSystem = getContainingSubSystem(item); |
6405 |
ISubSystem subSystem = getContainingSubSystem(item); |
6328 |
if (subSystem != null) |
6406 |
if (subSystem != null) |
6329 |
{ |
6407 |
{ |
6330 |
return new ContextObject(data, subSystem); |
6408 |
return new ContextObjectWithViewer(data, subSystem, this); |
6331 |
} |
6409 |
} |
6332 |
else |
6410 |
else |
6333 |
{ |
6411 |
{ |
6334 |
return new ContextObject(data); |
6412 |
return new ContextObjectWithViewer(data, this); |
6335 |
} |
6413 |
} |
6336 |
} |
6414 |
} |
6337 |
} |
6415 |
} |
Lines 6365-6374
Link Here
|
6365 |
} |
6443 |
} |
6366 |
|
6444 |
|
6367 |
/** |
6445 |
/** |
6368 |
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead |
6446 |
* For bug 187739 |
6369 |
* of the model object, itself |
|
|
6370 |
*/ |
6447 |
*/ |
6371 |
protected void createChildren(final Widget widget) |
6448 |
protected void createChildren(final Widget widget, IRSECallback callback) |
6372 |
{ |
6449 |
{ |
6373 |
if (widget instanceof TreeItem) |
6450 |
if (widget instanceof TreeItem) |
6374 |
{ |
6451 |
{ |
Lines 6379-6384
Link Here
|
6379 |
return; // children already there! |
6456 |
return; // children already there! |
6380 |
} |
6457 |
} |
6381 |
} |
6458 |
} |
|
|
6459 |
final IRSECallback cb = callback; |
6382 |
|
6460 |
|
6383 |
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() { |
6461 |
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() { |
6384 |
public void run() { |
6462 |
public void run() { |
Lines 6399-6404
Link Here
|
6399 |
if (d != null) |
6477 |
if (d != null) |
6400 |
{ |
6478 |
{ |
6401 |
Object parentElement = getContextObject((TreeItem)widget); |
6479 |
Object parentElement = getContextObject((TreeItem)widget); |
|
|
6480 |
if (cb != null && parentElement instanceof ContextObjectWithViewer){ |
6481 |
((ContextObjectWithViewer)parentElement).setCallback(cb); |
6482 |
} |
6483 |
|
6402 |
Object[] children = getSortedChildren(parentElement); |
6484 |
Object[] children = getSortedChildren(parentElement); |
6403 |
if (children != null) |
6485 |
if (children != null) |
6404 |
{ |
6486 |
{ |
Lines 6417-6422
Link Here
|
6417 |
super.createChildren(widget); |
6499 |
super.createChildren(widget); |
6418 |
} |
6500 |
} |
6419 |
} |
6501 |
} |
|
|
6502 |
|
6503 |
/** |
6504 |
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead |
6505 |
* of the model object, itself |
6506 |
*/ |
6507 |
protected void createChildren(final Widget widget) |
6508 |
{ |
6509 |
createChildren(widget, null); |
6510 |
} |
6420 |
|
6511 |
|
6421 |
/** |
6512 |
/** |
6422 |
* Override to pass context into hasChildren() |
6513 |
* Override to pass context into hasChildren() |