From: Jean-Christian Kouame Date: Wed, 9 Mar 2016 19:22:43 +0000 (-0500) Subject: tmf : Add parameters to XML core methods X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=0b563c20f81019f611286286281a3ef1cfd846f5;p=deliverable%2Ftracecompass.git tmf : Add parameters to XML core methods Add ScenarioInfo as parameters to XML core module methods. This will help to get the active scenario details (quark, scenarioName, scenarioState, ...) and use them when necessary during a pattern analysis. If there is no scenario, the value is set to null. Change-Id: I17f65b73cb236e81221c355a3cb2fce9800d4fe5 Signed-off-by: Jean-Christian Kouame Reviewed-on: https://git.eclipse.org/r/68090 Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam Reviewed-by: Hudson CI Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien --- diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/TmfXmlPatternSegmentBuilderTest.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/TmfXmlPatternSegmentBuilderTest.java index c67794a33c..6d4d804742 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/TmfXmlPatternSegmentBuilderTest.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core.tests/src/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stateprovider/TmfXmlPatternSegmentBuilderTest.java @@ -95,7 +95,8 @@ public class TmfXmlPatternSegmentBuilderTest { //Create a pattern segment and test its content TmfXmlPatternSegment segment = builder.generatePatternSegment(PatternSegmentFactoryStub.TEST_2_END_EVENT, PatternSegmentFactoryStub.TEST_2_START_EVENT.getTimestamp(), - PatternSegmentFactoryStub.TEST_2_END_EVENT.getTimestamp()); + PatternSegmentFactoryStub.TEST_2_END_EVENT.getTimestamp(), + null); XmlUtilsTest.testPatternSegmentData(PatternSegmentFactoryStub.TEST_2, segment); } } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateAttribute.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateAttribute.java index a5b584660a..8763b0af21 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateAttribute.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateAttribute.java @@ -31,12 +31,17 @@ public interface ITmfXmlStateAttribute { * builder mode. * * @param startQuark - * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to search - * the full attribute tree + * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to + * search the full attribute tree + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return the quark described by attribute or - * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be found + * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be + * found + * @since 2.0 */ - int getAttributeQuark(int startQuark); + int getAttributeQuark(int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo); /** * This method gets the quark for this state attribute in the State System. @@ -48,10 +53,15 @@ public interface ITmfXmlStateAttribute { * @param event * The current event being handled * @param startQuark - * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to search - * the full attribute tree + * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to + * search the full attribute tree + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return the quark described by attribute or - * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be found + * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be + * found + * @since 2.0 */ - int getAttributeQuark(@Nullable ITmfEvent event, int startQuark); + int getAttributeQuark(@Nullable ITmfEvent event, int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo); } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateValue.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateValue.java index 7c3ad98739..4b38263327 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateValue.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/ITmfXmlStateValue.java @@ -37,11 +37,15 @@ public interface ITmfXmlStateValue { * @param event * The current event or null if no event is * available. + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return the {@link ITmfStateValue} * @throws AttributeNotFoundException * May be thrown by the state system during the query + * @since 2.0 */ - ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException; + ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException; /** * Get the value of the event field that is the path of this state value @@ -65,13 +69,17 @@ public interface ITmfXmlStateValue { * * @param event * The event to process + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @throws AttributeNotFoundException * Pass through the exception it received * @throws TimeRangeException * Pass through the exception it received * @throws StateValueTypeException * Pass through the exception it received + * @since 2.0 */ - void handleEvent(ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException; + void handleEvent(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException; } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlCondition.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlCondition.java index efef34bcc3..f76627f39e 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlCondition.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlCondition.java @@ -207,21 +207,24 @@ public class TmfXmlCondition { * * @param event * The event on which to test the condition + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return Whether the condition is true or not * @throws AttributeNotFoundException * The state attribute was not found - * @since 1.0 + * @since 2.0 */ - public boolean testForEvent(ITmfEvent event) throws AttributeNotFoundException { + public boolean testForEvent(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { ITmfStateSystem ss = fContainer.getStateSystem(); if (!fStateValues.isEmpty()) { - return testForEvent(event, NonNullUtils.checkNotNull(ss)); + return testForEvent(event, NonNullUtils.checkNotNull(ss), scenarioInfo); } else if (!fConditions.isEmpty()) { /* Verify a condition tree */ switch (fOperator) { case AND: for (TmfXmlCondition childCondition : fConditions) { - if (!childCondition.testForEvent(event)) { + if (!childCondition.testForEvent(event, scenarioInfo)) { return false; } } @@ -229,10 +232,10 @@ public class TmfXmlCondition { case NONE: break; case NOT: - return !fConditions.get(0).testForEvent(event); + return !fConditions.get(0).testForEvent(event, scenarioInfo); case OR: for (TmfXmlCondition childCondition : fConditions) { - if (childCondition.testForEvent(event)) { + if (childCondition.testForEvent(event, scenarioInfo)) { return true; } } @@ -245,7 +248,7 @@ public class TmfXmlCondition { return true; } - private boolean testForEvent(ITmfEvent event, ITmfStateSystem ss) throws AttributeNotFoundException { + private boolean testForEvent(ITmfEvent event, ITmfStateSystem ss, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { /* * The condition is either the equality check of a state value or a * boolean operation on other conditions @@ -254,7 +257,7 @@ public class TmfXmlCondition { ITmfXmlStateValue filter = fStateValues.get(0); int quark = IXmlStateSystemContainer.ROOT_QUARK; for (ITmfXmlStateAttribute attribute : filter.getAttributes()) { - quark = attribute.getAttributeQuark(event, quark); + quark = attribute.getAttributeQuark(event, quark, scenarioInfo); /* * When verifying a condition, the state attribute must exist, * if it does not, the query is not valid, we stop the condition @@ -273,12 +276,12 @@ public class TmfXmlCondition { /* Get the value to compare to from the XML file */ ITmfStateValue valueXML; - valueXML = filter.getValue(event); + valueXML = filter.getValue(event, scenarioInfo); return compare(valueState, valueXML, fConditionOperator); } /* Get the two values needed for the comparison */ - ITmfStateValue valuesXML1 = fStateValues.get(0).getValue(event); - ITmfStateValue valuesXML2 = fStateValues.get(1).getValue(event); + ITmfStateValue valuesXML1 = fStateValues.get(0).getValue(event, scenarioInfo); + ITmfStateValue valuesXML2 = fStateValues.get(1).getValue(event, scenarioInfo); return valuesXML1.equals(valuesXML2); } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlEventHandler.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlEventHandler.java index 2393c28ac7..e91fbd5ad0 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlEventHandler.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlEventHandler.java @@ -103,7 +103,7 @@ public class TmfXmlEventHandler { /* Process all state changes */ for (TmfXmlStateChange stateChange : fStateChangeList) { try { - stateChange.handleEvent(event); + stateChange.handleEvent(event, null); } catch (AttributeNotFoundException ae) { /* * This would indicate a problem with the logic of the manager diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlLocation.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlLocation.java index 51ebde5f50..6a46e77a19 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlLocation.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlLocation.java @@ -85,16 +85,21 @@ public class TmfXmlLocation { * * @param event * The event being handled + * * @param startQuark * The starting quark for relative search, use * {@link IXmlStateSystemContainer#ROOT_QUARK} for the root of * the attribute tree + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return The quark at the leaf of the path + * @since 2.0 */ - public int getLocationQuark(@Nullable ITmfEvent event, int startQuark) { + public int getLocationQuark(@Nullable ITmfEvent event, int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo) { int quark = startQuark; for (ITmfXmlStateAttribute attrib : fPath) { - quark = attrib.getAttributeQuark(event, quark); + quark = attrib.getAttributeQuark(event, quark, scenarioInfo); if (quark == IXmlStateSystemContainer.ERROR_QUARK) { break; } @@ -109,12 +114,16 @@ public class TmfXmlLocation { * The starting quark for relative search, use * {@link IXmlStateSystemContainer#ROOT_QUARK} for the root of * the attribute tree + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return The quark at the leaf of the path + * @since 2.0 */ - public int getLocationQuark(int startQuark) { + public int getLocationQuark(int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo) { int quark = startQuark; for (ITmfXmlStateAttribute attrib : fPath) { - quark = attrib.getAttributeQuark(quark); + quark = attrib.getAttributeQuark(quark, scenarioInfo); if (quark == IXmlStateSystemContainer.ERROR_QUARK) { break; } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlPatternSegmentBuilder.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlPatternSegmentBuilder.java index 6c445cadf6..848cd6db9a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlPatternSegmentBuilder.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlPatternSegmentBuilder.java @@ -94,15 +94,18 @@ public class TmfXmlPatternSegmentBuilder { * Start time of the pattern segment to generate * @param end * End time of the pattern segment to generate + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return The pattern segment generated */ - public TmfXmlPatternSegment generatePatternSegment(ITmfEvent event, ITmfTimestamp start, ITmfTimestamp end) { + public TmfXmlPatternSegment generatePatternSegment(ITmfEvent event, ITmfTimestamp start, ITmfTimestamp end, @Nullable TmfXmlScenarioInfo scenarioInfo) { int scale = event.getTimestamp().getScale(); long startValue = start.toNanos(); long endValue = end.toNanos(); - String segmentName = getPatternSegmentName(event); + String segmentName = getPatternSegmentName(event, scenarioInfo); Map fields = new HashMap<>(); - setPatternSegmentContent(event, start, end, fields); + setPatternSegmentContent(event, start, end, fields, scenarioInfo); TmfXmlPatternSegment segment = new TmfXmlPatternSegment(startValue, endValue, scale, segmentName, fields); if (fContainer instanceof XmlPatternStateProvider) { ((XmlPatternStateProvider) fContainer).getListener().onNewSegment(segment); @@ -115,10 +118,13 @@ public class TmfXmlPatternSegmentBuilder { * * @param event * The active event + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. * @return The name of the segment */ - private String getPatternSegmentName(ITmfEvent event) { - return fSegmentType.getName(event); + private String getPatternSegmentName(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) { + return fSegmentType.getName(event, scenarioInfo); } /** @@ -133,10 +139,13 @@ public class TmfXmlPatternSegmentBuilder { * The end timestamp of this segment * @param fields * The map that will contained all the fields + * @param scenarioInfo + * The active scenario details. Or null if there is + * no scenario. */ - private void setPatternSegmentContent(ITmfEvent event, ITmfTimestamp start, ITmfTimestamp end, Map fields) { + private void setPatternSegmentContent(ITmfEvent event, ITmfTimestamp start, ITmfTimestamp end, Map fields, @Nullable TmfXmlScenarioInfo scenarioInfo) { for (TmfXmlPatternSegmentField field : fFields) { - fields.put(field.getName(), field.getValue(event)); + fields.put(field.getName(), field.getValue(event, scenarioInfo)); } } @@ -155,9 +164,9 @@ public class TmfXmlPatternSegmentBuilder { } } - private static void getNameFromXmlStateValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue) { + private static void getNameFromXmlStateValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue, @Nullable TmfXmlScenarioInfo scenarioInfo) { try { - ITmfStateValue value = xmlStateValue.getValue(event); + ITmfStateValue value = xmlStateValue.getValue(event, scenarioInfo); switch (value.getType()) { case DOUBLE: builder.append(value.unboxDouble()); @@ -229,13 +238,16 @@ public class TmfXmlPatternSegmentBuilder { * The active event * @return The state value representing the value of the XML pattern * segment field + * @param scenarioInfo + * The active scenario details. Or null if there + * is no scenario. */ - public ITmfStateValue getValue(ITmfEvent event) { + public ITmfStateValue getValue(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) { if (fStateValue != null) { return fStateValue; } try { - return checkNotNull(fXmlStateValue).getValue(event); + return checkNotNull(fXmlStateValue).getValue(event, scenarioInfo); } catch (AttributeNotFoundException e) { Activator.logError("Failed to get the state value", e); //$NON-NLS-1$ } @@ -288,12 +300,15 @@ public class TmfXmlPatternSegmentBuilder { * * @param event * The active event + * @param scenarioInfo + * The active scenario details. Or null if there + * is no scenario. * @return The segment name */ - public String getName(ITmfEvent event) { + public String getName(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) { StringBuilder name = new StringBuilder(PATTERN_SEGMENT_NAME_PREFIX); if (fNameStateValue != null) { - getNameFromXmlStateValue(event, name, fNameStateValue); + getNameFromXmlStateValue(event, name, fNameStateValue, scenarioInfo); } else { name.append(fSegmentNameAttribute); } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlScenarioInfo.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlScenarioInfo.java new file mode 100644 index 0000000000..c6132e3a79 --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlScenarioInfo.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2016 Ericsson + * + * 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 + * http://www.eclipse.org/legal/epl-v10.html + ******************************************************************************/ +package org.eclipse.tracecompass.tmf.analysis.xml.core.model; + +/** + * This class gives basic details about a scenario (quark, scenarioName, ...) + * + * @author Jean-Christian Kouame + * @since 2.0 + */ +public class TmfXmlScenarioInfo { + private final String fScenarioName; + private final int fQuark; + private String fActiveState; + + /** + * Constructor + * + * @param scenarioName + * The scenario name + * @param activeState + * The active state + * @param quark + * The scenario quark + */ + public TmfXmlScenarioInfo(String scenarioName, String activeState, int quark) { + fScenarioName = scenarioName; + fActiveState = activeState; + fQuark = quark; + } + + /** + * Set the active state + * + * @param activeState + * The active state + */ + public void setActiveState(String activeState) { + fActiveState = activeState; + } + + /** + * Get the scenario quark + * + * @return The quark + */ + public int getQuark() { + return fQuark; + } + + /** + * Get the scenario name + * + * @return The name + */ + public String getScenarioName() { + return fScenarioName; + } + + /** + * Get the scenario active state + * + * @return The active state + */ + public String getActiveState() { + return fActiveState; + } +} diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateAttribute.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateAttribute.java index 6116f2f7a6..5aafea46ce 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateAttribute.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateAttribute.java @@ -16,6 +16,9 @@ import java.util.LinkedList; import java.util.List; import org.eclipse.jdt.annotation.Nullable; +import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString; +import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; + import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; @@ -60,6 +63,10 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { EVENTNAME } + private final String SCENARIO_NAME = "#scenarioName"; //$NON-NLS-1$ + + private final String CURRENT_STATE = "#currentState"; //$NON-NLS-1$ + /** Type of attribute */ private final StateAttributeType fType; @@ -127,22 +134,11 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { } /** - * This method gets the quark for this state attribute in the State System. - * - * Unless this attribute is a location, in which case the quark must exist, - * the quark will be added to the state system if the state system is in - * builder mode. - * - * @param startQuark - * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to - * search the full attribute tree - * @return the quark described by attribute or - * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be - * found + * @since 2.0 */ @Override - public int getAttributeQuark(int startQuark) { - return getAttributeQuark(null, startQuark); + public int getAttributeQuark(int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo) { + return getAttributeQuark(null, startQuark, scenarioInfo); } /** @@ -188,37 +184,31 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { } /** - * This method gets the quark for this state attribute in the State System. - * - * Unless this attribute is a location, in which case the quark must exist, - * the quark will be added to the state system if the state system is in - * builder mode. - * - * @param event - * The current event being handled, or null if no - * event available in the context - * @param startQuark - * root quark, use {@link IXmlStateSystemContainer#ROOT_QUARK} to - * search the full attribute tree - * @return the quark described by attribute or - * {@link IXmlStateSystemContainer#ERROR_QUARK} if quark cannot be - * found + * @since 2.0 */ @Override - public int getAttributeQuark(@Nullable ITmfEvent event, int startQuark) { + public int getAttributeQuark(@Nullable ITmfEvent event, int startQuark, @Nullable TmfXmlScenarioInfo scenarioInfo) { ITmfStateSystem ss = getStateSystem(); if (ss == null) { throw new IllegalStateException("The state system hasn't been initialized yet"); //$NON-NLS-1$ } + String name = nullToEmptyString(fName); + if (name.length() > 0 && name.charAt(0) == '#' && scenarioInfo == null) { + throw new IllegalStateException("XML Attribute needs " + fName + " but the data is not available."); //$NON-NLS-1$//$NON-NLS-2$ + } + name = name.equals(SCENARIO_NAME) ? checkNotNull(scenarioInfo).getScenarioName() : name.equals(CURRENT_STATE) ? checkNotNull(scenarioInfo).getActiveState() : fName; try { switch (fType) { case CONSTANT: { int quark; + if (name == null) { + throw new IllegalStateException("Invalid attribute name"); //$NON-NLS-1$ + } if (startQuark == IXmlStateSystemContainer.ROOT_QUARK) { - quark = getQuarkAbsoluteAndAdd(fName); + quark = getQuarkAbsoluteAndAdd(name); } else { - quark = getQuarkRelativeAndAdd(startQuark, fName); + quark = getQuarkRelativeAndAdd(startQuark, name); } return quark; } @@ -228,10 +218,8 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { Activator.logWarning("XML State attribute: looking for an event field, but event is null"); //$NON-NLS-1$ return quark; } - /* special case if field is CPU which is not in the field */ - String name = fName; if (name == null) { - throw new IllegalStateException(); + throw new IllegalStateException("Invalid attribute name"); //$NON-NLS-1$ } if (name.equals(TmfXmlStrings.CPU)) { /* See if the event advertises a CPU aspect */ @@ -243,11 +231,11 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { } else { final ITmfEventField content = event.getContent(); /* stop if the event field doesn't exist */ - if (content.getField(fName) == null) { + if (content.getField(name) == null) { return IXmlStateSystemContainer.ERROR_QUARK; } - Object field = content.getField(fName).getValue(); + Object field = content.getField(name).getValue(); if (field instanceof String) { String fieldString = (String) field; @@ -268,7 +256,7 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { int quarkQuery = IXmlStateSystemContainer.ROOT_QUARK; for (ITmfXmlStateAttribute attrib : fQueryList) { - quarkQuery = attrib.getAttributeQuark(event, quarkQuery); + quarkQuery = attrib.getAttributeQuark(event, quarkQuery, scenarioInfo); if (quarkQuery == IXmlStateSystemContainer.ERROR_QUARK) { break; } @@ -306,12 +294,12 @@ public abstract class TmfXmlStateAttribute implements ITmfXmlStateAttribute { } case LOCATION: { int quark = startQuark; - String idLocation = fName; + String idLocation = name; /* TODO: Add a fContainer.getLocation(id) method */ for (TmfXmlLocation location : fContainer.getLocations()) { if (location.getId().equals(idLocation)) { - quark = location.getLocationQuark(event, quark); + quark = location.getLocationQuark(event, quark, scenarioInfo); if (quark == IXmlStateSystemContainer.ERROR_QUARK) { break; } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateChange.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateChange.java index 8f238da3d8..63662ebe36 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateChange.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateChange.java @@ -100,15 +100,19 @@ public class TmfXmlStateChange { * * @param event * The event to process + * @param scenarioInfo + * The active scenario details. The value should be null if there + * no scenario. * @throws AttributeNotFoundException * Pass through the exception it received * @throws TimeRangeException * Pass through the exception it received * @throws StateValueTypeException * Pass through the exception it received + * @since 2.0 */ - public void handleEvent(ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { - fChange.handleEvent(event); + public void handleEvent(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { + fChange.handleEvent(event, scenarioInfo); } @Override @@ -118,7 +122,7 @@ public class TmfXmlStateChange { /* Interface for both private classes to handle the event */ private interface IXmlStateChange { - void handleEvent(ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException; + void handleEvent(ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException; } /** @@ -154,10 +158,10 @@ public class TmfXmlStateChange { } @Override - public void handleEvent(@NonNull ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { + public void handleEvent(@NonNull ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { TmfXmlStateChange toExecute = fThenChange; try { - if (!fCondition.testForEvent(event)) { + if (!fCondition.testForEvent(event, scenarioInfo)) { toExecute = fElseChange; } } catch (AttributeNotFoundException e) { @@ -171,7 +175,7 @@ public class TmfXmlStateChange { if (toExecute == null) { return; } - toExecute.handleEvent(event); + toExecute.handleEvent(event, scenarioInfo); } @Override @@ -212,8 +216,8 @@ public class TmfXmlStateChange { } @Override - public void handleEvent(@NonNull ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { - fValue.handleEvent(event); + public void handleEvent(@NonNull ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { + fValue.handleEvent(event, scenarioInfo); } @Override diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateValue.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateValue.java index 92a0830b2d..d7e2d0b6d8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateValue.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlStateValue.java @@ -215,19 +215,11 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { } /** - * Get the current {@link ITmfStateValue} of this state value for an event. - * It does not increment the value and does not any other processing of the - * value. - * - * @param event - * The current event, or null if no event available. - * @return the {@link ITmfStateValue} - * @throws AttributeNotFoundException - * May be thrown by the state system during the query + * @since 2.0 */ @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException { - return fStateValue.getValue(event); + public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { + return fStateValue.getValue(event, scenarioInfo); } /** @@ -375,24 +367,14 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { } /** - * Handles an event, by setting the value of the attribute described by the - * state attribute path in the state system. - * - * @param event - * The event to process - * @throws AttributeNotFoundException - * Pass through the exception it received - * @throws TimeRangeException - * Pass through the exception it received - * @throws StateValueTypeException - * Pass through the exception it received + * @since 2.0 */ @Override - public void handleEvent(@NonNull ITmfEvent event) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { + public void handleEvent(@NonNull ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException, StateValueTypeException, TimeRangeException { int quark = IXmlStateSystemContainer.ROOT_QUARK; for (ITmfXmlStateAttribute attribute : fPath) { - quark = attribute.getAttributeQuark(event, quark); + quark = attribute.getAttributeQuark(event, quark, scenarioInfo); /* the query is not valid, we stop the state change */ if (quark == IXmlStateSystemContainer.ERROR_QUARK) { throw new AttributeNotFoundException("Not found XML attribute " + attribute); //$NON-NLS-1$ @@ -400,7 +382,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { } long ts = event.getTimestamp().getValue(); - fStateValue.handleEvent(event, quark, ts); + fStateValue.handleEvent(event, quark, ts, scenarioInfo); } @Override @@ -428,11 +410,15 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { * The event which can be used to retrieve the value if * necessary. The event can be null if no event * is required. + * @param scenarioInfo + * The active scenario details. The value should be null if + * there no scenario. * @return The state value corresponding to this XML state value * @throws AttributeNotFoundException * Pass through the exception it received + * @since 2.0 */ - public abstract ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException; + public abstract ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException; /** * Do something with the state value, possibly using an event @@ -444,18 +430,22 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { * The quark for this value * @param timestamp * The timestamp of the event + * @param scenarioInfo + * The active scenario details. The value should be null if + * there no scenario. * @throws StateValueTypeException * Pass through the exception it received * @throws TimeRangeException * Pass through the exception it received * @throws AttributeNotFoundException * Pass through the exception it received + * @since 2.0 */ - public void handleEvent(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + public void handleEvent(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { if (fIncrement) { - incrementValue(event, quark, timestamp); + incrementValue(event, quark, timestamp, scenarioInfo); } else { - ITmfStateValue value = getValue(event); + ITmfStateValue value = getValue(event, scenarioInfo); processValue(quark, timestamp, value); } } @@ -489,15 +479,19 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { * The quark for this value * @param timestamp * The timestamp of the event + * @param scenarioInfo + * The active scenario details. The value should be null if + * there no scenario. * @throws StateValueTypeException * Pass through the exception it received * @throws TimeRangeException * Pass through the exception it received * @throws AttributeNotFoundException * Pass through the exception it received + * @since 2.0 */ @SuppressWarnings("unused") - protected void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + protected void incrementValue(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { } } @@ -505,7 +499,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue { private class TmfXmlStateValueNull extends TmfXmlStateValueBase { @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException { + public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { return TmfStateValue.nullValue(); } diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/readwrite/TmfXmlReadWriteStateValue.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/readwrite/TmfXmlReadWriteStateValue.java index 06e590662d..a356417570 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/readwrite/TmfXmlReadWriteStateValue.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/readwrite/TmfXmlReadWriteStateValue.java @@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.analysis.xml.core.model.readwrite; import java.util.ArrayList; import java.util.List; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; @@ -27,6 +28,7 @@ import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue; import org.eclipse.tracecompass.tmf.analysis.xml.core.model.ITmfXmlModelFactory; import org.eclipse.tracecompass.tmf.analysis.xml.core.model.ITmfXmlStateAttribute; +import org.eclipse.tracecompass.tmf.analysis.xml.core.model.TmfXmlScenarioInfo; import org.eclipse.tracecompass.tmf.analysis.xml.core.model.TmfXmlStateValue; import org.eclipse.tracecompass.tmf.analysis.xml.core.module.IXmlStateSystemContainer; import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils; @@ -165,11 +167,11 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { protected abstract class TmfXmlStateValueTypeReadWrite extends TmfXmlStateValueBase { @Override - public final void handleEvent(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + public final void handleEvent(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { if (isIncrement()) { - incrementValue(event, quark, timestamp); + incrementValue(event, quark, timestamp, scenarioInfo); } else { - ITmfStateValue value = getValue(event); + ITmfStateValue value = getValue(event, scenarioInfo); processValue(quark, timestamp, value); } } @@ -196,7 +198,7 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - protected void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + protected void incrementValue(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); @@ -240,12 +242,12 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) { + public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) { return fValue; } @Override - public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + public void incrementValue(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystem ss = getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); @@ -275,7 +277,7 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) { + public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) { if (event == null) { Activator.logWarning("XML State value: requested an event field, but event is null"); //$NON-NLS-1$ return TmfStateValue.nullValue(); @@ -284,12 +286,12 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + public void incrementValue(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystem ss = getSsContainer().getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); } - ITmfStateValue incrementValue = getValue(event); + ITmfStateValue incrementValue = getValue(event, scenarioInfo); ITmfStateValue value = incrementByType(quark, ss, incrementValue); if (value != null) { processValue(quark, timestamp, value); @@ -308,7 +310,7 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { private class TmfXmlStateValueEventName extends TmfXmlStateValueTypeReadWrite { @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) { + public @NonNull ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { if (event == null) { Activator.logWarning("XML State value: request event name, but event is null"); //$NON-NLS-1$ return TmfStateValue.nullValue(); @@ -320,14 +322,13 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { public String toString() { return "Event name"; //$NON-NLS-1$ } - } /* The state value deletes an attribute */ private class TmfXmlStateValueDelete extends TmfXmlStateValueTypeReadWrite { @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException { + public @NonNull ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { return TmfStateValue.nullValue(); } @@ -357,7 +358,7 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - public ITmfStateValue getValue(@Nullable ITmfEvent event) throws AttributeNotFoundException { + public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { /* Query the state system for the value */ ITmfStateValue value = TmfStateValue.nullValue(); int quarkQuery = IXmlStateSystemContainer.ROOT_QUARK; @@ -367,7 +368,7 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } for (ITmfXmlStateAttribute attribute : fQueryValue) { - quarkQuery = attribute.getAttributeQuark(event, quarkQuery); + quarkQuery = attribute.getAttributeQuark(event, quarkQuery, scenarioInfo); if (quarkQuery == IXmlStateSystemContainer.ERROR_QUARK) { /* the query is not valid, we stop the state change */ break; @@ -384,13 +385,13 @@ public class TmfXmlReadWriteStateValue extends TmfXmlStateValue { } @Override - public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { + public void incrementValue(ITmfEvent event, int quark, long timestamp, @Nullable TmfXmlScenarioInfo scenarioInfo) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystem ss = getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); } - ITmfStateValue incrementValue = getValue(event); + ITmfStateValue incrementValue = getValue(event, scenarioInfo); ITmfStateValue value = incrementByType(quark, ss, incrementValue); if (value != null) { processValue(quark, timestamp, value); diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlXYViewer.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlXYViewer.java index af2cde8b60..2fb3339e8a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlXYViewer.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlXYViewer.java @@ -260,7 +260,7 @@ public class XmlXYViewer extends TmfCommonXLineChartViewer { if (seriesNameAttrib == null) { seriesName = ss.getAttributeName(quark); } else { - int seriesNameQuark = seriesNameAttrib.getAttributeQuark(quark); + int seriesNameQuark = seriesNameAttrib.getAttributeQuark(quark, null); try { ITmfStateValue seriesNameValue = ss.querySingleState(start, seriesNameQuark).getStateValue(); if (!seriesNameValue.isNull()) { @@ -277,7 +277,7 @@ public class XmlXYViewer extends TmfCommonXLineChartViewer { seriesName = ss.getAttributeName(quark); } } - fSeriesData.put(quark, new SeriesData(xvalues.length, display.getAttributeQuark(quark), seriesName, entry.getType())); + fSeriesData.put(quark, new SeriesData(xvalues.length, display.getAttributeQuark(quark, null), seriesName, entry.getType())); } for (int i = 0; i < xvalues.length; i++) { if (monitor != null && monitor.isCanceled()) { diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlEntry.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlEntry.java index 0b3550fbd5..89af65be3a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlEntry.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlEntry.java @@ -158,7 +158,7 @@ public class XmlEntry extends TimeGraphEntry implements IXmlStateSystemContainer ITmfXmlModelFactory factory = TmfXmlReadOnlyModelFactory.getInstance(); ITmfXmlStateAttribute display = factory.createStateAttribute(stateAttribute, this); - int quark = display.getAttributeQuark(fBaseQuark); + int quark = display.getAttributeQuark(fBaseQuark, null); if (quark != IXmlStateSystemContainer.ERROR_QUARK) { ITmfStateInterval firstInterval = StateSystemUtils.queryUntilNonNullValue(fSs, quark, getStartTime(), getEndTime()); if (firstInterval != null) { diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java index c6f46ae00d..e7116ff571 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java @@ -383,7 +383,7 @@ public class XmlTimeGraphView extends AbstractTimeGraphView { * attribute */ ITmfXmlStateAttribute display = fFactory.createStateAttribute(displayEl, parentEntry); - int displayQuark = display.getAttributeQuark(quark); + int displayQuark = display.getAttributeQuark(quark, null); if (displayQuark == IXmlStateSystemContainer.ERROR_QUARK) { return new XmlEntry(quark, parentEntry.getTrace(), String.format("Unknown display quark for %s", ss.getAttributeName(quark)), ss); //$NON-NLS-1$