1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-21 23:33:57 +02:00

[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

This commit is contained in:
David McKnight 2007-02-22 15:47:24 +00:00
parent 87b7858bf6
commit a5abca5d90
2 changed files with 9 additions and 26 deletions

View file

@ -1275,9 +1275,9 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
* Returns the implementation of IRemoteObjectIdentifier for the given * Returns the implementation of IRemoteObjectIdentifier for the given
* object. Returns null if this object does not adaptable to this. * 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) protected ISystemViewElementAdapter getViewAdapter(Object o)
@ -1312,8 +1312,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
return ((ISubSystem) (((ISystemFilterPoolReference) firstSelection).getProvider())).getHost(); return ((ISubSystem) (((ISystemFilterPoolReference) firstSelection).getProvider())).getHost();
else if (firstSelection instanceof ISystemFilterReference) else if (firstSelection instanceof ISystemFilterReference)
return ((ISubSystem) (((ISystemFilterReference) firstSelection).getProvider())).getHost(); return ((ISubSystem) (((ISystemFilterReference) firstSelection).getProvider())).getHost();
else if (getRemoteAdapter(firstSelection) != null) { else if (getViewAdapter(firstSelection) != null) {
ISubSystem ss = getAdapter(firstSelection).getSubSystem(firstSelection); ISubSystem ss = getViewAdapter(firstSelection).getSubSystem(firstSelection);
if (ss != null) if (ss != null)
return ss.getHost(); return ss.getHost();
else else
@ -3774,12 +3774,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
return null; 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. * 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(); element = elements.next();
//multiSource[idx++] = element; //multiSource[idx++] = element;
adapter = getAdapter(element); adapter = getAdapter(element);
if (getRemoteAdapter(element) != null) continue; if (getAdapter(element) != null) continue;
ok = adapter.doDelete(getShell(), element, monitor); ok = adapter.doDelete(getShell(), element, monitor);
if (ok) { if (ok) {
anyOk = true; anyOk = true;
@ -5088,7 +5083,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
TreeItem selectedItem = getFirstSelectedTreeItem(); TreeItem selectedItem = getFirstSelectedTreeItem();
if (selectedItem == null) return; if (selectedItem == null) return;
Object element = selectedItem.getData(); Object element = selectedItem.getData();
IRemoteObjectIdentifier remoteAdapter = getRemoteAdapter(element); ISystemViewElementAdapter remoteAdapter = getViewAdapter(element);
if (remoteAdapter == null) return; if (remoteAdapter == null) return;
// update our hashtables, keyed by object address and tree path... // update our hashtables, keyed by object address and tree path...
if (expandToFiltersByObject == null) expandToFiltersByObject = new Hashtable(); if (expandToFiltersByObject == null) expandToFiltersByObject = new Hashtable();

View file

@ -1165,7 +1165,7 @@ public class SystemTableView
remoteResourceName = (String) remoteResource; remoteResourceName = (String) remoteResource;
else else
{ {
IRemoteObjectIdentifier ra = getRemoteObjectIdentifier(remoteResource); IRemoteObjectIdentifier ra = getAdapter(remoteResource);
if (ra == null) if (ra == null)
return null; return null;
remoteResourceName = ra.getAbsoluteName(remoteResource); remoteResourceName = ra.getAbsoluteName(remoteResource);
@ -1514,7 +1514,7 @@ public class SystemTableView
adapter = getAdapter(element); adapter = getAdapter(element);
Object parentElement = getParentForContent(element); Object parentElement = getParentForContent(element);
remoteAdapter = getRemoteObjectIdentifier(element); remoteAdapter = getAdapter(element);
if (remoteAdapter != null) if (remoteAdapter != null)
oldFullName = remoteAdapter.getAbsoluteName(element); oldFullName = remoteAdapter.getAbsoluteName(element);
// pre-rename // pre-rename
@ -1571,18 +1571,6 @@ public class SystemTableView
return adapter; 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. * Return true if select all should be enabled for the given object.