From a5abca5d904e5c098b4a10fe353c11155844aabd Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 22 Feb 2007 15:47:24 +0000 Subject: [PATCH] [174942] getting rid of remote object identifier code. This seems to be problemmatic everywhere. Restoring the code to use either ISystemViewelementAdapter where possible, and ISystemRemoteElementAdapter only for cases where special handling is required --- .../rse/internal/ui/view/SystemView.java | 19 +++++++------------ .../eclipse/rse/ui/view/SystemTableView.java | 16 ++-------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java index af70d2e44e5..0a28b385007 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java @@ -1275,9 +1275,9 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe * Returns the implementation of IRemoteObjectIdentifier for the given * object. Returns null if this object does not adaptable to this. */ - protected IRemoteObjectIdentifier getRemoteAdapter(Object o) + protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) { - return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class); + return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class); } protected ISystemViewElementAdapter getViewAdapter(Object o) @@ -1312,8 +1312,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe return ((ISubSystem) (((ISystemFilterPoolReference) firstSelection).getProvider())).getHost(); else if (firstSelection instanceof ISystemFilterReference) return ((ISubSystem) (((ISystemFilterReference) firstSelection).getProvider())).getHost(); - else if (getRemoteAdapter(firstSelection) != null) { - ISubSystem ss = getAdapter(firstSelection).getSubSystem(firstSelection); + else if (getViewAdapter(firstSelection) != null) { + ISubSystem ss = getViewAdapter(firstSelection).getSubSystem(firstSelection); if (ss != null) return ss.getHost(); else @@ -3774,12 +3774,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe return null; } - protected IRemoteObjectIdentifier getRemoteData(Item item, Object rawData) { - if (rawData != null) - return getRemoteAdapter(rawData); - else - return null; - } + /** * Find the first binary-match or name-match of remote object, given its absolute name. @@ -4367,7 +4362,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe element = elements.next(); //multiSource[idx++] = element; adapter = getAdapter(element); - if (getRemoteAdapter(element) != null) continue; + if (getAdapter(element) != null) continue; ok = adapter.doDelete(getShell(), element, monitor); if (ok) { anyOk = true; @@ -5088,7 +5083,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe TreeItem selectedItem = getFirstSelectedTreeItem(); if (selectedItem == null) return; Object element = selectedItem.getData(); - IRemoteObjectIdentifier remoteAdapter = getRemoteAdapter(element); + ISystemViewElementAdapter remoteAdapter = getViewAdapter(element); if (remoteAdapter == null) return; // update our hashtables, keyed by object address and tree path... if (expandToFiltersByObject == null) expandToFiltersByObject = new Hashtable(); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java index 4b5a37c0499..ae77cd1c131 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java @@ -1165,7 +1165,7 @@ public class SystemTableView remoteResourceName = (String) remoteResource; else { - IRemoteObjectIdentifier ra = getRemoteObjectIdentifier(remoteResource); + IRemoteObjectIdentifier ra = getAdapter(remoteResource); if (ra == null) return null; remoteResourceName = ra.getAbsoluteName(remoteResource); @@ -1514,7 +1514,7 @@ public class SystemTableView adapter = getAdapter(element); Object parentElement = getParentForContent(element); - remoteAdapter = getRemoteObjectIdentifier(element); + remoteAdapter = getAdapter(element); if (remoteAdapter != null) oldFullName = remoteAdapter.getAbsoluteName(element); // pre-rename @@ -1571,18 +1571,6 @@ public class SystemTableView return adapter; } - /** - * Returns the implementation of IRemoteObjectIdentifier for the given - * object. Returns null if this object does not adaptable to this. - */ - protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o) - { - IRemoteObjectIdentifier objectId = null; - try{ - objectId = (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class); - }catch(ClassCastException e){} - return objectId; - } /** * Return true if select all should be enabled for the given object.