1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

Cosmetics

Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-03-23 09:50:37 -04:00
parent 677a49200d
commit 088569b1cf

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2011 Texas Instruments, Inc. and others.
* Copyright (c) 2010, 2015 Texas Instruments, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,21 +38,21 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
* This class is a base class of AbstractThreadVMNode and AbstractContainerVMNode.
* It contains common functionality between these classes.
*
* The main reason this class is introduce is to allow the debug view to
* The main reason this class is introduced is to allow the debug view to
* show multiple levels of execution containers and properly handle the delta generation.
*
* Longer term we would like to merge the classes AbstractContainerVMNode and
* In the longer term we would like to merge the classes AbstractContainerVMNode and
* AbstractThreadVMNode. That will make the implementation of both classes
* more generic and robust in the case of recursive containers.
*
* Having this class as a base for both AbstractContainerVMNode and
* AbstractThreadVMNode enables us to merge them in the future.
*
* Originally DefaultVMModelProxyStrategy didn't accept recursive container for
* Originally DefaultVMModelProxyStrategy didn't accept recursive containers for
* generating deltas, even though they are accepted and supported by
* AbstractDMVMProvider for viewing.
* The approach I took to support recursive container in delta generation is to have
* the VMNodes to generate level by level its deltas instead of one the whole delta at once.
* The approach I took to support recursive containers for delta generation is to have
* the VMNodes generate their deltas level by level, instead of one whole delta at once.
* That required changes in identifying which is the correct context for each of the events.
*
* See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=240208
@ -66,13 +66,13 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* List that keeps track of which events are considered leave events for
* delta creation.
*/
protected ArrayList<Class<?>> leafEventTypes = new ArrayList<Class<?>>();
protected ArrayList<Class<?>> leafEventTypes = new ArrayList<>();
/**
* List that keeps track of which events are considered container events for
* delta creation.
*/
protected ArrayList<Class<?>> containerEventTypes = new ArrayList<Class<?>>();
protected ArrayList<Class<?>> containerEventTypes = new ArrayList<>();
/**
* Constructor.
@ -112,13 +112,13 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
*
* @param eventClass
*/
protected void addEventType( Class<? extends IDMEvent<?>> eventClass, boolean containerEvent)
{
if( containerEvent)
protected void addEventType(Class<? extends IDMEvent<?>> eventClass, boolean containerEvent) {
if (containerEvent) {
containerEventTypes.add(eventClass);
else
} else {
leafEventTypes.add(eventClass);
}
}
/**
* If DSF debuggers overrides the behavior of the AbstractThreadVMNode
@ -129,11 +129,12 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param containerEvent
*/
protected void removeEventType(Class<?> eventClass, boolean containerEvent) {
if( containerEvent)
if (containerEvent) {
containerEventTypes.remove(eventClass);
else
} else {
leafEventTypes.remove(eventClass);
}
}
/**
@ -144,7 +145,7 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param rm - request monitor
* @return true if the context is set by the method.
*/
protected boolean getContextsForRecursiveVMNode(VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) {
protected boolean getContextsForRecursiveVMNode(VMDelta parentDelta, Object e, DataRequestMonitor<IVMContext[]> rm) {
IExecutionDMContext leafContext = null;
if (isExecutionContainerEvent(e)) {
@ -166,10 +167,10 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param e - the events.
* @param parentDelta
* @param nodeOffset
* @param requestMonitor
* @param rm
* @return true if the delta is built by this method.
*/
protected boolean buildDeltaForRecursiveVMNode(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
protected boolean buildDeltaForRecursiveVMNode(Object e, final VMDelta parentDelta, int nodeOffset, RequestMonitor rm) {
IExecutionDMContext leafContext = null;
if (isExecutionContainerEvent(e)) {
@ -179,7 +180,7 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
leafContext = getLeafContextForLeafEvent(e);
}
if (leafContext != null) {
addOneLevelToDelta( leafContext, parentDelta, requestMonitor);
addOneLevelToDelta(leafContext, parentDelta, rm);
return true;
}
return false;
@ -226,13 +227,15 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
IExecutionDMContext leafEC = null;
if( event instanceof IDMEvent<?>)
if (event instanceof IDMEvent<?>) {
if (isExecutionLeafEvent(event)) {
IDMEvent<?> typedEvent = (IDMEvent<?>)event;
IDMContext dmContext = typedEvent.getDMContext();
if( dmContext instanceof IExecutionDMContext)
if (dmContext instanceof IExecutionDMContext) {
leafEC = (IExecutionDMContext)dmContext;
}
}
}
return leafEC;
}
@ -308,8 +311,9 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
current = parent;
}
}
if( all == null)
if (all == null) {
all = new IVMContext[0];
}
rm.setData(all);
rm.done();
}
@ -321,10 +325,12 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @return
*/
protected boolean isExecutionContainerEvent(Object event) {
if( event != null)
if (event != null) {
for (Class<?> clazz : containerEventTypes)
if( clazz.isAssignableFrom(event.getClass()))
if (clazz.isAssignableFrom(event.getClass())) {
return true;
}
}
return false;
}
@ -335,10 +341,13 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @return
*/
protected boolean isExecutionLeafEvent(Object event) {
if( event != null)
for( Class<?> clazz : leafEventTypes)
if( clazz.isAssignableFrom(event.getClass()))
if (event != null) {
for (Class<?> clazz : leafEventTypes) {
if (clazz.isAssignableFrom(event.getClass())) {
return true;
}
}
}
return false;
}
}