mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
[170627] mark methods that must be overridden final. Rename getAdapter() -> getSystemViewElementAdapter(). Deprecate methods to be removed.
This commit is contained in:
parent
449b582072
commit
64b0a51349
7 changed files with 47 additions and 21 deletions
|
@ -232,7 +232,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
|
|||
for (int idx=0; (match==null) && (idx<children.length); idx++)
|
||||
{
|
||||
Object child = children[idx];
|
||||
String objName = getAdapter(child).getName(child);
|
||||
String objName = getSystemViewElementAdapter(child).getName(child);
|
||||
if ((objName != null) && (objName.equals(preSelectName)))
|
||||
match = child;
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ public class SystemViewFilterPoolReferenceAdapter
|
|||
public String getInputMementoHandle(Object 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.
|
||||
|
|
|
@ -740,14 +740,14 @@ public class SystemViewFilterReferenceAdapter
|
|||
public String getInputMementoHandle(Object element)
|
||||
{
|
||||
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();
|
||||
if (parent instanceof ISystemFilterPoolReference) // not a nested filter
|
||||
{
|
||||
if (!showFPs) // not showing the real parent in GUI?
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -724,7 +724,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
|
|||
public String getInputMementoHandle(Object 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.
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
* Set the viewer that is driving this adapter
|
||||
* Called by label and content provider.
|
||||
*/
|
||||
public void setViewer(Viewer viewer)
|
||||
public final void setViewer(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>
|
||||
* 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;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
* May be used by an adapter to retrieve context-sensitive information.
|
||||
* 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;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
/**
|
||||
* <i>Getter method. Callable by subclasses. Do not override.</i><br>
|
||||
* 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()
|
||||
{
|
||||
|
@ -466,7 +466,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
* Implementation of IWorkbenchAdapter.getChildren(). Rather than overriding this, adapter implementors
|
||||
* 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);
|
||||
}
|
||||
|
@ -733,6 +733,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
@ -752,6 +753,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** @deprecated this should be done in the SystemView only */
|
||||
private Widget findItemInTree(TreeViewer tree, Object element)
|
||||
{
|
||||
Item[] items = getChildren(tree.getControl());
|
||||
|
@ -767,6 +769,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
return null;
|
||||
}
|
||||
|
||||
/** @deprecated this should be done in the SystemView only */
|
||||
private Widget internalFindItem(Tree tree, Item parent, Object element)
|
||||
{
|
||||
// compare with node
|
||||
|
@ -787,6 +790,8 @@ public abstract class AbstractSystemViewAdapter
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @deprecated this should be done in the SystemView only */
|
||||
private Item[] getChildren(Widget o)
|
||||
{
|
||||
if (o instanceof TreeItem)
|
||||
|
@ -795,7 +800,6 @@ public abstract class AbstractSystemViewAdapter
|
|||
return ((Tree) o).getItems();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <i><b>Overridable</b> by subclasses. Must be iff editable properties are supported.</i><br>
|
||||
|
@ -1520,9 +1524,16 @@ public abstract class AbstractSystemViewAdapter
|
|||
* Returns the implementation of ISystemViewElement for the given
|
||||
* object. Returns null if the adapter is not defined or the
|
||||
* 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());
|
||||
/*
|
||||
|
@ -1539,12 +1550,20 @@ public abstract class AbstractSystemViewAdapter
|
|||
}
|
||||
return adapter;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <i>Callable by subclasses.</i><br>
|
||||
* Returns the implementation of ISystemRemoteElement for the given
|
||||
* 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)
|
||||
{
|
||||
|
@ -1671,7 +1690,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
/**
|
||||
* <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);
|
||||
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>
|
||||
* 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)
|
||||
initMsgObjects();
|
||||
|
@ -1717,7 +1736,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
* <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()
|
||||
*/
|
||||
protected Object[] getFailedMessageObject()
|
||||
protected final Object[] getFailedMessageObject()
|
||||
{
|
||||
if (errorObject == null)
|
||||
initMsgObjects();
|
||||
|
@ -1728,7 +1747,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
* <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()
|
||||
*/
|
||||
protected Object[] getEmptyMessageObject()
|
||||
protected final Object[] getEmptyMessageObject()
|
||||
{
|
||||
if (nullObject == null)
|
||||
initMsgObjects();
|
||||
|
|
|
@ -97,7 +97,11 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
|
|||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
|
|
@ -57,8 +57,10 @@ public class SystemAdapterHelpers {
|
|||
*/
|
||||
public static ISystemViewElementAdapter getAdapter(Object o, Viewer viewer) {
|
||||
ISystemViewElementAdapter adapter = getAdapter(o);
|
||||
if (adapter != null)
|
||||
if (adapter != null) {
|
||||
//FIXME This is not thread-safe.
|
||||
adapter.setViewer(viewer);
|
||||
}
|
||||
return adapter;
|
||||
}
|
||||
|
||||
|
@ -71,6 +73,7 @@ public class SystemAdapterHelpers {
|
|||
ISystemViewElementAdapter adapter = getAdapter(o, viewer);
|
||||
|
||||
if (adapter != null) {
|
||||
//FIXME This is not thread-safe.
|
||||
adapter.setInput(inputProvider);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue