diff --git a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/analysis/AnalysisScriptingModule.java b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/analysis/AnalysisScriptingModule.java index 3db87d904..3fbfe46fc 100644 --- a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/analysis/AnalysisScriptingModule.java +++ b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/analysis/AnalysisScriptingModule.java @@ -13,6 +13,7 @@ import org.eclipse.ease.modules.WrapToScript; import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.tracecompass.incubator.scripting.core.trace.TraceScriptingModule; import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; @@ -35,8 +36,9 @@ * provider with script-defined entries and arrows (javascript) *
null
if the field is not
* found
+ * @deprecated This method has been moved to the
+ * {@link TraceScriptingModule#getEventFieldValue(ITmfEvent,
+ * String)} class.
*/
+ @Deprecated
@WrapToScript
public @Nullable Object getFieldValue(ITmfEvent event, String fieldName) {
diff --git a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/trace/TraceScriptingModule.java b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/trace/TraceScriptingModule.java
index b24b47928..e7816b0c9 100644
--- a/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/trace/TraceScriptingModule.java
+++ b/analyses/org.eclipse.tracecompass.incubator.scripting.core/src/org/eclipse/tracecompass/incubator/scripting/core/trace/TraceScriptingModule.java
@@ -25,12 +25,14 @@
import org.eclipse.tracecompass.incubator.internal.scripting.core.trace.Messages;
import org.eclipse.tracecompass.incubator.internal.scripting.core.trace.ScriptEventRequest;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceImportException;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
/**
* Scripting modules to open and manipulate traces
@@ -176,4 +178,30 @@ public Iteratornull
if the field is not
+ * found
+ */
+ @WrapToScript
+ public @Nullable Object getEventFieldValue(ITmfEvent event, String fieldName) {
+
+ final ITmfEventField field = event.getContent().getField(fieldName);
+
+ /* If the field does not exist, see if it's a special case */
+ if (field == null) {
+ // This will allow to use any column as input
+ return TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), fieldName, event);
+ }
+ return field.getValue();
+
+ }
}