1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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. * This class is a base class of AbstractThreadVMNode and AbstractContainerVMNode.
* It contains common functionality between these classes. * 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. * 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 * AbstractThreadVMNode. That will make the implementation of both classes
* more generic and robust in the case of recursive containers. * more generic and robust in the case of recursive containers.
* *
* Having this class as a base for both AbstractContainerVMNode and * Having this class as a base for both AbstractContainerVMNode and
* AbstractThreadVMNode enables us to merge them in the future. * 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 * generating deltas, even though they are accepted and supported by
* AbstractDMVMProvider for viewing. * AbstractDMVMProvider for viewing.
* The approach I took to support recursive container in delta generation is to have * The approach I took to support recursive containers for delta generation is to have
* the VMNodes to generate level by level its deltas instead of one the whole delta at once. * 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. * 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 * 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 * List that keeps track of which events are considered leave events for
* delta creation. * 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 * List that keeps track of which events are considered container events for
* delta creation. * delta creation.
*/ */
protected ArrayList<Class<?>> containerEventTypes = new ArrayList<Class<?>>(); protected ArrayList<Class<?>> containerEventTypes = new ArrayList<>();
/** /**
* Constructor. * Constructor.
@ -112,13 +112,13 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* *
* @param eventClass * @param eventClass
*/ */
protected void addEventType( Class<? extends IDMEvent<?>> eventClass, boolean containerEvent) protected void addEventType(Class<? extends IDMEvent<?>> eventClass, boolean containerEvent) {
{ if (containerEvent) {
if( containerEvent)
containerEventTypes.add(eventClass); containerEventTypes.add(eventClass);
else } else {
leafEventTypes.add(eventClass); leafEventTypes.add(eventClass);
} }
}
/** /**
* If DSF debuggers overrides the behavior of the AbstractThreadVMNode * If DSF debuggers overrides the behavior of the AbstractThreadVMNode
@ -129,11 +129,12 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param containerEvent * @param containerEvent
*/ */
protected void removeEventType(Class<?> eventClass, boolean containerEvent) { protected void removeEventType(Class<?> eventClass, boolean containerEvent) {
if( containerEvent) if (containerEvent) {
containerEventTypes.remove(eventClass); containerEventTypes.remove(eventClass);
else } else {
leafEventTypes.remove(eventClass); leafEventTypes.remove(eventClass);
} }
}
/** /**
@ -144,7 +145,7 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param rm - request monitor * @param rm - request monitor
* @return true if the context is set by the method. * @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; IExecutionDMContext leafContext = null;
if (isExecutionContainerEvent(e)) { if (isExecutionContainerEvent(e)) {
@ -166,10 +167,10 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @param e - the events. * @param e - the events.
* @param parentDelta * @param parentDelta
* @param nodeOffset * @param nodeOffset
* @param requestMonitor * @param rm
* @return true if the delta is built by this method. * @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; IExecutionDMContext leafContext = null;
if (isExecutionContainerEvent(e)) { if (isExecutionContainerEvent(e)) {
@ -179,7 +180,7 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
leafContext = getLeafContextForLeafEvent(e); leafContext = getLeafContextForLeafEvent(e);
} }
if (leafContext != null) { if (leafContext != null) {
addOneLevelToDelta( leafContext, parentDelta, requestMonitor); addOneLevelToDelta(leafContext, parentDelta, rm);
return true; return true;
} }
return false; return false;
@ -226,13 +227,15 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
IExecutionDMContext leafEC = null; IExecutionDMContext leafEC = null;
if( event instanceof IDMEvent<?>) if (event instanceof IDMEvent<?>) {
if (isExecutionLeafEvent(event)) { if (isExecutionLeafEvent(event)) {
IDMEvent<?> typedEvent = (IDMEvent<?>)event; IDMEvent<?> typedEvent = (IDMEvent<?>)event;
IDMContext dmContext = typedEvent.getDMContext(); IDMContext dmContext = typedEvent.getDMContext();
if( dmContext instanceof IExecutionDMContext) if (dmContext instanceof IExecutionDMContext) {
leafEC = (IExecutionDMContext)dmContext; leafEC = (IExecutionDMContext)dmContext;
} }
}
}
return leafEC; return leafEC;
} }
@ -308,8 +311,9 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
current = parent; current = parent;
} }
} }
if( all == null) if (all == null) {
all = new IVMContext[0]; all = new IVMContext[0];
}
rm.setData(all); rm.setData(all);
rm.done(); rm.done();
} }
@ -321,10 +325,12 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @return * @return
*/ */
protected boolean isExecutionContainerEvent(Object event) { protected boolean isExecutionContainerEvent(Object event) {
if( event != null) if (event != null) {
for (Class<?> clazz : containerEventTypes) for (Class<?> clazz : containerEventTypes)
if( clazz.isAssignableFrom(event.getClass())) if (clazz.isAssignableFrom(event.getClass())) {
return true; return true;
}
}
return false; return false;
} }
@ -335,10 +341,13 @@ public abstract class AbstractExecutionContextVMNode extends AbstractDMVMNode
* @return * @return
*/ */
protected boolean isExecutionLeafEvent(Object event) { protected boolean isExecutionLeafEvent(Object event) {
if( event != null) if (event != null) {
for( Class<?> clazz : leafEventTypes) for (Class<?> clazz : leafEventTypes) {
if( clazz.isAssignableFrom(event.getClass())) if (clazz.isAssignableFrom(event.getClass())) {
return true; return true;
}
}
}
return false; return false;
} }
} }