1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-07 08:15:48 +02:00

[170627] mark methods that must be overridden final. Rename getAdapter() -> getSystemViewElementAdapter(). Deprecate methods to be removed.

This commit is contained in:
Martin Oberhuber 2007-02-19 11:42:59 +00:00
parent 449b582072
commit 64b0a51349
7 changed files with 47 additions and 21 deletions

View file

@ -232,7 +232,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
for (int idx=0; (match==null) && (idx<children.length); idx++) for (int idx=0; (match==null) && (idx<children.length); idx++)
{ {
Object child = children[idx]; Object child = children[idx];
String objName = getAdapter(child).getName(child); String objName = getSystemViewElementAdapter(child).getName(child);
if ((objName != null) && (objName.equals(preSelectName))) if ((objName != null) && (objName.equals(preSelectName)))
match = child; match = child;
} }

View file

@ -368,7 +368,7 @@ public class SystemViewFilterPoolReferenceAdapter
public String getInputMementoHandle(Object element) public String getInputMementoHandle(Object element)
{ {
Object parent = getParent(element); Object parent = getParent(element);
return getAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element); return getSystemViewElementAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
} }
/** /**
* Return a short string to uniquely identify the type of resource. Eg "conn" for connection. * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.

View file

@ -740,14 +740,14 @@ public class SystemViewFilterReferenceAdapter
public String getInputMementoHandle(Object element) public String getInputMementoHandle(Object element)
{ {
Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool
ISystemViewElementAdapter parentAdapter = getAdapter(parent); ISystemViewElementAdapter parentAdapter = getSystemViewElementAdapter(parent);
boolean showFPs = SystemPreferencesManager.getShowFilterPools(); boolean showFPs = SystemPreferencesManager.getShowFilterPools();
if (parent instanceof ISystemFilterPoolReference) // not a nested filter if (parent instanceof ISystemFilterPoolReference) // not a nested filter
{ {
if (!showFPs) // not showing the real parent in GUI? if (!showFPs) // not showing the real parent in GUI?
{ {
parent = parentAdapter.getParent(parent); // get the subsystem parent of the filter pool reference parent = parentAdapter.getParent(parent); // get the subsystem parent of the filter pool reference
parentAdapter = getAdapter(parent); // get the adapter for the subsystem parent parentAdapter = getSystemViewElementAdapter(parent); // get the adapter for the subsystem parent
} }
} }
return parentAdapter.getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element); return parentAdapter.getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);

View file

@ -724,7 +724,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
public String getInputMementoHandle(Object element) public String getInputMementoHandle(Object element)
{ {
Object parent = getParent(element); Object parent = getParent(element);
return getAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element); return getSystemViewElementAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
} }
/** /**
* Return a short string to uniquely identify the type of resource. Eg "conn" for connection. * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.

View file

@ -171,7 +171,7 @@ public abstract class AbstractSystemViewAdapter
* Set the viewer that is driving this adapter * Set the viewer that is driving this adapter
* Called by label and content provider. * Called by label and content provider.
*/ */
public void setViewer(Viewer viewer) public final void setViewer(Viewer viewer)
{ {
this.viewer = viewer; this.viewer = viewer;
} }
@ -179,7 +179,7 @@ public abstract class AbstractSystemViewAdapter
* <i>Configuration method. Typically called by content provider, viewer or action. Do not override.</i><br> * <i>Configuration method. Typically called by content provider, viewer or action. Do not override.</i><br>
* Set the shell to be used by any method that requires it. * Set the shell to be used by any method that requires it.
*/ */
public void setShell(Shell shell) public final void setShell(Shell shell)
{ {
this.shell = shell; this.shell = shell;
} }
@ -189,7 +189,7 @@ public abstract class AbstractSystemViewAdapter
* May be used by an adapter to retrieve context-sensitive information. * May be used by an adapter to retrieve context-sensitive information.
* This is set by the Label and Content providers that retrieve this adapter. * This is set by the Label and Content providers that retrieve this adapter.
*/ */
public void setInput(ISystemViewInputProvider input) public final void setInput(ISystemViewInputProvider input)
{ {
this.input = input; this.input = input;
} }
@ -225,7 +225,7 @@ public abstract class AbstractSystemViewAdapter
/** /**
* <i>Getter method. Callable by subclasses. Do not override.</i><br> * <i>Getter method. Callable by subclasses. Do not override.</i><br>
* Return the current viewer, as set via setViewer or its deduced from the * Return the current viewer, as set via setViewer or its deduced from the
* setInput input object if set. May be null so test it. * setInput input object if set. May be null so test it.
*/ */
public Viewer getViewer() public Viewer getViewer()
{ {
@ -466,7 +466,7 @@ public abstract class AbstractSystemViewAdapter
* Implementation of IWorkbenchAdapter.getChildren(). Rather than overriding this, adapter implementors * Implementation of IWorkbenchAdapter.getChildren(). Rather than overriding this, adapter implementors
* should override the getChildren() methods that take a monitor. * should override the getChildren() methods that take a monitor.
*/ */
public Object[] getChildren(Object object) public final Object[] getChildren(Object object)
{ {
return getChildren(new NullProgressMonitor(), (IAdaptable)object); return getChildren(new NullProgressMonitor(), (IAdaptable)object);
} }
@ -733,6 +733,7 @@ public abstract class AbstractSystemViewAdapter
/** /**
* Return the number of immediate children in the tree, for the given tree node * Return the number of immediate children in the tree, for the given tree node
* @deprecated this should be done in the SystemView only
*/ */
private int getChildCount(TreeViewer viewer, Object element) private int getChildCount(TreeViewer viewer, Object element)
{ {
@ -752,6 +753,7 @@ public abstract class AbstractSystemViewAdapter
return 0; return 0;
} }
/** @deprecated this should be done in the SystemView only */
private Widget findItemInTree(TreeViewer tree, Object element) private Widget findItemInTree(TreeViewer tree, Object element)
{ {
Item[] items = getChildren(tree.getControl()); Item[] items = getChildren(tree.getControl());
@ -767,6 +769,7 @@ public abstract class AbstractSystemViewAdapter
return null; return null;
} }
/** @deprecated this should be done in the SystemView only */
private Widget internalFindItem(Tree tree, Item parent, Object element) private Widget internalFindItem(Tree tree, Item parent, Object element)
{ {
// compare with node // compare with node
@ -787,6 +790,8 @@ public abstract class AbstractSystemViewAdapter
} }
return null; return null;
} }
/** @deprecated this should be done in the SystemView only */
private Item[] getChildren(Widget o) private Item[] getChildren(Widget o)
{ {
if (o instanceof TreeItem) if (o instanceof TreeItem)
@ -796,7 +801,6 @@ public abstract class AbstractSystemViewAdapter
return null; return null;
} }
/** /**
* <i><b>Overridable</b> by subclasses. Must be iff editable properties are supported.</i><br> * <i><b>Overridable</b> by subclasses. Must be iff editable properties are supported.</i><br>
* Returns whether the property value has changed from the default. * Returns whether the property value has changed from the default.
@ -1520,9 +1524,16 @@ public abstract class AbstractSystemViewAdapter
* Returns the implementation of ISystemViewElement for the given * Returns the implementation of ISystemViewElement for the given
* object. Returns null if the adapter is not defined or the * object. Returns null if the adapter is not defined or the
* object is not adaptable. * object is not adaptable.
* <p>Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getAdapter(Object, Viewer)} * <p/>
* Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getAdapter(Object, Viewer)}
* <p/>
* Should we allow clients to override this in order to provide an
* optimized implementation for their models? But it's being called
* by subclasses only anyways...
*
* @deprecated use SystemAdapterHelpers.getAdapter(o, getViewer()) instead
*/ */
protected ISystemViewElementAdapter getAdapter(Object o) protected ISystemViewElementAdapter getSystemViewElementAdapter(Object o)
{ {
return SystemAdapterHelpers.getAdapter(o, getViewer()); return SystemAdapterHelpers.getAdapter(o, getViewer());
/* /*
@ -1540,11 +1551,19 @@ public abstract class AbstractSystemViewAdapter
return adapter; return adapter;
*/ */
} }
/** /**
* <i>Callable by subclasses.</i><br> * <i>Callable by subclasses.</i><br>
* Returns the implementation of ISystemRemoteElement for the given * Returns the implementation of ISystemRemoteElement 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.
* <p>Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getRemoteAdapter(Object, Viewer)} * <p/>
* Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getRemoteAdapter(Object, Viewer)}
* <p/>
* Should we allow clients to override this in order to provide an
* optimized implementation for their models? But it's being called
* by subclasses only anyways...
*
* @deprecated use SystemAdapterHelpers.getRemoteAdapter(o, getViewer()) instead
*/ */
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
{ {
@ -1671,7 +1690,7 @@ public abstract class AbstractSystemViewAdapter
/** /**
* <i>Internal use. Do not override</i><br> * <i>Internal use. Do not override</i><br>
*/ */
protected void initMsgObjects() protected final void initMsgObjects()
{ {
nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null); nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null); canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
@ -1706,7 +1725,7 @@ public abstract class AbstractSystemViewAdapter
* <i>Callable by subclasses. Do not override</i><br> * <i>Callable by subclasses. Do not override</i><br>
* Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren() * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
*/ */
protected Object[] getCancelledMessageObject() protected final Object[] getCancelledMessageObject()
{ {
if (canceledObject == null) if (canceledObject == null)
initMsgObjects(); initMsgObjects();
@ -1717,7 +1736,7 @@ public abstract class AbstractSystemViewAdapter
* <i>Callable by subclasses. Do not override</i><br> * <i>Callable by subclasses. Do not override</i><br>
* Return the "Operation failed" msg as an object array so can be used to answer getChildren() * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
*/ */
protected Object[] getFailedMessageObject() protected final Object[] getFailedMessageObject()
{ {
if (errorObject == null) if (errorObject == null)
initMsgObjects(); initMsgObjects();
@ -1728,7 +1747,7 @@ public abstract class AbstractSystemViewAdapter
* <i>Callable by subclasses. Do not override</i><br> * <i>Callable by subclasses. Do not override</i><br>
* Return the "Empty list" msg as an object array so can be used to answer getChildren() * Return the "Empty list" msg as an object array so can be used to answer getChildren()
*/ */
protected Object[] getEmptyMessageObject() protected final Object[] getEmptyMessageObject()
{ {
if (nullObject == null) if (nullObject == null)
initMsgObjects(); initMsgObjects();

View file

@ -98,6 +98,10 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
/** /**
* Get the subsystem that corresponds to this object if one exists. * Get the subsystem that corresponds to this object if one exists.
* *
* @param element The element to be identified. May be of type
* {@link IContextObject} (including the context of the element),
* {@link String} (giving the absolute path of a remote object),
* or the actual remote data element itself.
*/ */
public ISubSystem getSubSystem(Object element); public ISubSystem getSubSystem(Object element);

View file

@ -57,8 +57,10 @@ public class SystemAdapterHelpers {
*/ */
public static ISystemViewElementAdapter getAdapter(Object o, Viewer viewer) { public static ISystemViewElementAdapter getAdapter(Object o, Viewer viewer) {
ISystemViewElementAdapter adapter = getAdapter(o); ISystemViewElementAdapter adapter = getAdapter(o);
if (adapter != null) if (adapter != null) {
//FIXME This is not thread-safe.
adapter.setViewer(viewer); adapter.setViewer(viewer);
}
return adapter; return adapter;
} }
@ -71,6 +73,7 @@ public class SystemAdapterHelpers {
ISystemViewElementAdapter adapter = getAdapter(o, viewer); ISystemViewElementAdapter adapter = getAdapter(o, viewer);
if (adapter != null) { if (adapter != null) {
//FIXME This is not thread-safe.
adapter.setInput(inputProvider); adapter.setInput(inputProvider);
} }