diff options
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java')
-rw-r--r-- | dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java | 129 |
1 files changed, 63 insertions, 66 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java index 033c2447444..187a20f3a66 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/datamodel/RootDMVMNode.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ @@ -22,76 +22,73 @@ import org.eclipse.cdt.dsf.ui.viewmodel.RootVMNode; /** * This is is a standard root node which listens to the selection in Debug View. - * Views such as variables and registers base their content on the + * Views such as variables and registers base their content on the * selection in Debug view, and this node provides tracking of that selection. * <p> - * Note: The variables/registers views track the selection using the same - * IDebugContextListener interface, but they only use the first element of the - * selection, as in IStructuredSelection.getFirstElement(). Therefore the root - * node also has to use the first element as the root object instead of the - * whole selection. - * + * Note: The variables/registers views track the selection using the same + * IDebugContextListener interface, but they only use the first element of the + * selection, as in IStructuredSelection.getFirstElement(). Therefore the root + * node also has to use the first element as the root object instead of the + * whole selection. + * * @since 1.0 */ -public class RootDMVMNode extends RootVMNode - implements IRootVMNode -{ - public RootDMVMNode(AbstractVMProvider provider) { - super(provider); - } +public class RootDMVMNode extends RootVMNode implements IRootVMNode { + public RootDMVMNode(AbstractVMProvider provider) { + super(provider); + } + + @Override + public String toString() { + return "RootDMVMNode"; //$NON-NLS-1$ + } + + /** + * If the input object is a Data Model context, and the event is a DMC event. + * Then we can filter the event to make sure that the view does not + * react to events that relate to objects outside this view. + * + * The logic is such: + * - iterate through the full hierarchy of the DMC in the event, + * - for each DMC in event, search for a DMC of the same type in the input + * event, + * - if an ancestor of that type is found, it indicates that the event + * and the input object share the same hierarchy + * - finally compare the DMContexts from the event to the DMC from the input + * object, + * - if there is a match then we know that the event relates + * to the hierarchy in view, + * - if there is no match, then we know that the event related to a + * some sibling of the input object, and no delta should be generated, + * - if none of the ancestor types matched, then the event is completely + * unrelated to the input object, and the layout nodes in the view must + * determine whether a delta is needed. + */ + @Override + public boolean isDeltaEvent(Object rootObject, Object event) { + if (rootObject instanceof IDMVMContext) { + IDMContext inputDmc = ((IDMVMContext) rootObject).getDMContext(); + if (event instanceof IDMEvent && inputDmc != null) { + boolean potentialMatchFound = false; + boolean matchFound = false; + IDMContext eventDmc = ((IDMEvent<?>) event).getDMContext(); + for (IDMContext eventDmcAncestor : DMContexts.toList(eventDmc)) { + IDMContext inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass()); + if (inputDmcAncestor != null) { + potentialMatchFound = true; + if (inputDmcAncestor.equals(eventDmcAncestor)) { + return true; + } + } + } + if (potentialMatchFound && !matchFound) { + return false; + } + } + } - @Override - public String toString() { - return "RootDMVMNode"; //$NON-NLS-1$ - } + return true; + } - /** - * If the input object is a Data Model context, and the event is a DMC event. - * Then we can filter the event to make sure that the view does not - * react to events that relate to objects outside this view. - * - * The logic is such: - * - iterate through the full hierarchy of the DMC in the event, - * - for each DMC in event, search for a DMC of the same type in the input - * event, - * - if an ancestor of that type is found, it indicates that the event - * and the input object share the same hierarchy - * - finally compare the DMContexts from the event to the DMC from the input - * object, - * - if there is a match then we know that the event relates - * to the hierarchy in view, - * - if there is no match, then we know that the event related to a - * some sibling of the input object, and no delta should be generated, - * - if none of the ancestor types matched, then the event is completely - * unrelated to the input object, and the layout nodes in the view must - * determine whether a delta is needed. - */ - @Override - public boolean isDeltaEvent(Object rootObject, Object event) { - if (rootObject instanceof IDMVMContext) { - IDMContext inputDmc = ((IDMVMContext)rootObject).getDMContext(); - if (event instanceof IDMEvent && inputDmc != null) { - boolean potentialMatchFound = false; - boolean matchFound = false; - - IDMContext eventDmc = ((IDMEvent<?>)event).getDMContext(); - for (IDMContext eventDmcAncestor : DMContexts.toList(eventDmc)) { - IDMContext inputDmcAncestor = DMContexts.getAncestorOfType(inputDmc, eventDmcAncestor.getClass()); - if (inputDmcAncestor != null) { - potentialMatchFound = true; - if (inputDmcAncestor.equals(eventDmcAncestor)) { - return true; - } - } - } - if (potentialMatchFound && !matchFound) { - return false; - } - } - } - - return true; - } - } |