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

Documentation enhancements

This commit is contained in:
John Cortell 2009-10-06 20:28:34 +00:00
parent b2e5b8842d
commit 88fd43a9ec
2 changed files with 82 additions and 53 deletions

View file

@ -259,6 +259,10 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
* determine how elements of those types may be (or are) affected by * determine how elements of those types may be (or are) affected by
* [event], the answer being a collection of IModelDelta flags. * [event], the answer being a collection of IModelDelta flags.
* *
* A response of IModeDelta.CONTENT has a special meaning. If we return that
* flag for an IVMNode, it means the <i>collection</i> of elements of that
* type are affected. It is not a statement on the elements themselves.
*
* Optimization 1: If the first-level child node does not have * Optimization 1: If the first-level child node does not have
* <code>IModelDelta.CONTENT</code> but one of its descendants does, then * <code>IModelDelta.CONTENT</code> but one of its descendants does, then
* for optimization reasons we return <code>IModelDelta.STATE</code> * for optimization reasons we return <code>IModelDelta.STATE</code>
@ -622,24 +626,29 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
} }
/** /**
* Calls the specified child nodes to build the delta for the given event. * Calls the specified child nodes (of [node]) to build the delta for the
* @param childNodes Map of nodes to be invoked, and the corresponding delta * given event.
* flags that they will generate. This map is generated with a call to *
* {@link #getChildNodesWithDeltaFlags(Object)}. * @param childNodes
* @param delta The delta object to build on. This delta should have been * Map of nodes to be invoked, and the corresponding delta flags
* generated by this node, unless the full delta path is not being calculated * that they may (or will) generate. This map is generated with a
* due to an optimization. * call to {@link #getChildNodesWithDeltaFlags(Object)}.
* @param event The event object that the delta is being built for. * @param delta
* @param rm The result token to invoke when the delta is completed. * The delta object to build on. This delta should have been
* generated by this node, unless the full delta path is not
* being calculated due to an optimization.
* @param event
* The event object that the delta is being built for.
* @param rm
* The result monitor to invoke when the delta is completed.
*/ */
protected void callChildNodesToBuildDelta(final IVMNode node, final Map<IVMNode,Integer> childNodes, final VMDelta delta, protected void callChildNodesToBuildDelta(final IVMNode node, final Map<IVMNode,Integer> childNodes, final VMDelta delta,
final Object event, final RequestMonitor rm) final Object event, final RequestMonitor rm)
{ {
assert childNodes.size() != 0; assert childNodes.size() != 0;
// Check if any of the child nodes are will generate IModelDelta.SELECT or // Check if any of the child nodes might generate a delta that requires
// IModelDelta.EXPAND flags. If so, we must calculate the index for this // us to calculate the index for this VMC.
// VMC.
boolean calculateOffsets = false; boolean calculateOffsets = false;
for (int childDelta : childNodes.values()) { for (int childDelta : childNodes.values()) {
if ( (childDelta & (IModelDelta.SELECT | IModelDelta.EXPAND | IModelDelta.INSERTED | IModelDelta.REMOVED)) != 0 ) { if ( (childDelta & (IModelDelta.SELECT | IModelDelta.EXPAND | IModelDelta.INSERTED | IModelDelta.REMOVED)) != 0 ) {
@ -752,7 +761,8 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
/** /**
* Convenience method that returns what each of the child nodes returns from * Convenience method that returns what each of the child nodes returns from
* {@link #getDeltaFlags(IVMNode, ModelDelta, Object)}. * {@link #getDeltaFlags(IVMNode, ModelDelta, Object)}. Children that return
* IModelDelta.NO_CHANGE are omitted.
*/ */
protected Map<IVMNode, Integer> getChildNodesWithDeltaFlags(IVMNode node, ModelDelta parentDelta, Object e) { protected Map<IVMNode, Integer> getChildNodesWithDeltaFlags(IVMNode node, ModelDelta parentDelta, Object e) {
Map<IVMNode, Integer> nodes = new HashMap<IVMNode, Integer>(); Map<IVMNode, Integer> nodes = new HashMap<IVMNode, Integer>();

View file

@ -54,9 +54,21 @@ public interface IVMNode extends IElementContentProvider
public IVMProvider getVMProvider(); public IVMProvider getVMProvider();
/** /**
* Returns the potential delta flags that would be generated by this node * Returns a set of IModelDelta delta flags that indicate how elements of
* for the given event. * this node (type) may be, or are, affected by the given event. If the
* @param event Event to process. * implementation cannot make a definitive assessment synchronously, then it
* should provide the "worst case scenario" (all ways in which the elements
* <i>may</i> be affected). If a delta flag is not returned, it means for
* certain that elements of this node will not be affected in that way. That
* information allows us to optimize the delta creation.
*
* <p>
* A response of IModeDelta.CONTENT has a special meaning. If we return that
* flag, it means the <i>collection</i> of elements of our type are
* affected. It is not a statement on the elements themselves.
*
* @param event
* the event the caller is processing
* @return IModelDelta flags * @return IModelDelta flags
* @see #buildDelta(Object, VMDelta, int, RequestMonitor) * @see #buildDelta(Object, VMDelta, int, RequestMonitor)
* @see IModelDelta * @see IModelDelta
@ -66,30 +78,37 @@ public interface IVMNode extends IElementContentProvider
/** /**
* Builds model delta information based on the given event. * Builds model delta information based on the given event.
* <p> * <p>
* Model deltas, which are used to control the state of elements in the viewer, are * Model deltas, which are used to control the state of elements in the
* generated by the layout nodes by recursively calling this method on all the nodes * viewer, are generated by the layout nodes by recursively calling this
* in the layout tree. Each node implements two methods: {@link #getDeltaFlags(Object)}, * method on all the nodes in the layout tree. Each node implements two
* and <code>buildDelta()</code>. A parent node which is processing a * methods: {@link #getDeltaFlags(Object)}, and <code>buildDelta()</code>. A
* <code>buildDelta</code> operation needs to determine which of its elements are * parent node which is processing a <code>buildDelta</code> operation needs
* affected by a given event, set appropriate flags on these elements, and then * to determine which of its elements are affected by a given event, set
* it needs to call its child nodes with those elements to give the child nodes a * appropriate flags on these elements, and then it needs to call its child
* chance to add onto the delta. * nodes with those elements to give the child nodes a chance to add onto
* the delta.
* </p> * </p>
* <p> * <p>
* The <code>getDeltaFlags()</code> is a synchronous * The <code>getDeltaFlags()</code> is a synchronous call which tells the
* call which tells the parent node whether on not to call the child node's * parent node whether on not it needs to call us for a given child node,
* <code>buildDelta</code> with the given event. If a child node return * given the event it is processing. If a child node returns something other
* <code>true</code>, it only indicates that the node may add delta flags, but it * than IModelDelta.NO_CHANGE, then it is providing the set of flags that we
* does not require it to do so. * <i>might</i> end up adding to the delta, but it doesn't mean we are
* obligated to or will.
* </p> * </p>
* *
* @param event Event to process. * @param event
* @param parent Parent model delta node that this object should add delta * Event to process.
* data to. * @param parent
* @param nodeOffset The offset of the first element in this node. This offset * Parent model delta node that this object should add delta data
* depends on the elements returned by the siblings of this layout node. * to.
* @param requestMonitor Return token, which notifies the caller that the calculation is * @param nodeOffset
* complete. * The offset of the first element in this node. This offset
* depends on the elements returned by the siblings of this
* layout node.
* @param requestMonitor
* Return token, which notifies the caller that the calculation
* is complete.
*/ */
public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor); public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor);